Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-21593

Improve "Display Text" form fields so that they can resolve an array expression for a variable

    Details

    • Type: Improvement
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Alfresco Process Services 1.11
    • Component/s: APS Tasks
    • Labels:
      None
    • Bug Priority:
      Category 2
    • ACT Numbers:

      01008340

      Description

      Summary
      At the moment, a display text form field can only display values of other form fields or variables and can only resolve simple expressions like ${variableName}. There are situations, where it would be a big improvement if those fields could resolve array expressions, e.g. ${variableName[0]}, for example while using a form in a multi-instance user task and displaying different data of the collection element variable per instance.

      Steps to reproduce
      1. In App Designer in activiti-app design a simple process:
      start event -> script task -> user task -> end event
      2. Configure the script task to execute a groovy script:

      List<List<String>> MapVariable = new ArrayList<List<String>>();
      List<String> props = new ArrayList<String>();
      props.add("My first value");
      props.add("Value 1");
      props.add("Another value of first iteration");
      
      List<String> props1 = new ArrayList<String>();
      props1.add("My second value");
      props1.add("Value 2");
      props1.add("Another value of second iteration");
      
      MapVariable.add(props);
      MapVariable.add(props1);
      
      execution.setVariable("MapVariable", MapVariable);

      3. Configure the user taks to be a parallel multi-istance task:
      a) Set "${MapVariable}" for the multi-instance collection
      b) Set "variable" for the multi-instance element variable
      4. Add a form to the user task
      5. Add a "Display Text" field to the user task form and let it display:

      ${variable[0]}
      ${variable[1]}
      ${variable[2]}
      

      6. Save form and process and make it available via an app
      7. From the published app start a new process instance and inspect the user tasks and their forms

      Current behavioiur
      As the collection contains two lists, two user tasks have been created. Looking at the forms, the dispaly text field does not display values, as the array in the expression currently cannot be resolved.

      Desired behaviour
      There should be two user tasks, one task form showing the three values of the first list items, and the other task from showing the values of the second list items.

      Workaround
      In order to address the requirement to display the list items per user task, one has to introduce a complete multi-instance subprocess rather than just the multi-instance user task, whereas the subprocess is configured simialr to the user task before. In that subprocess, one requires a script task that gets the values of the collection variable and then sets them as local variables, e.g.

      execution.setVariableLocal("valueOne", variable[0]);
      execution.setVariableLocal("valueTwo", variable[1]);
      execution.setVariableLocal("valueThree", variable[2]);

      and those variables can be displayed in the user taks form display text field then as

      ${valueOne}
      ${valueTwo}
      ${valueThree}
      

        Attachments

          Structure

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dkoch Dennis Koch
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Structure Helper Panel