IT Process Automation

  • 1.  How to Feed Interaction form with array data during form initialization?

    Posted Aug 12, 2016 05:13 PM

    Does anyone have example process for feeding an User Interaction Form element simple array or table? I have a process which presents an array of files as part of the output get directory contents. I want to take that output and present it in user interaction form. I tried using the simple array and table form elements with no success. I think issue lies in defining the form element variable as an array in order to receive of an array . I know i can pull one of the index values of my array and present it in a text field  just to ensure there wasn't something wrong with my form in general. Any help would be appreciated. Thx Ed



  • 2.  Re: How to Feed Interaction form with array data during form initialization?
    Best Answer

    Broadcom Employee
    Posted Aug 13, 2016 04:00 PM

    Ed,

     

    I do this by converting the array to a JSON object, then passing the JSON as a string to the IRF.  Then, in the IRF, convert the JSON string to a JavaScript object, and populate the form table from that object.  That summary makes it sound more complicated than it is.  Here's an example:

     

    In the pre-execution code of the "Assign User Task", convert the array to a JSON string:

    json = new Array();

    for (var i=0; i<Process.event_data.length; i++) {
      json_row = {
         'event_name'  : event_data[i][0],
         'status'      : event_data[i][1],
         'user'        : event_data[i][2],
         'created_on'  : event_data[i][4]);
      json.push(json_row);
    }
    Process.json_string = stringifyJSON(json);

    Pass "Process.json_string" to a text item on the IRF called "data_json".

    In the Script section of the IRF, create a function that is called on the "onLoad" event:

    {

      load_table: function() {

        json = ca_pam_convertJSONToJSObject(ca_pam_getTextFieldValue('Form.data_json'));

        ca_pam_setTableDataFromJSObject('Form.updates', json);

      }

    }

     

    Of course, the table "Form.updates" was created with columns matching the member names of the JSON object: "name", "status", "user", "created_on".



  • 3.  Re: How to Feed Interaction form with array data during form initialization?

    Posted Aug 15, 2016 10:03 AM

    Hi Bill,

    Thanks for replying and let me see if this works for me. I will keep you posted on my status.

     

    Thx

    again

    Ed



  • 4.  Re: How to Feed Interaction form with array data during form initialization?

    Posted Aug 31, 2016 10:24 AM
      |   view attached

    Just quick update although Bill's method was helpful, I ended using out of the box PAM content. In cases anyone is interested I have uploaded the xml example to this response.

     

    Thx

    Ed

    Attachment(s)