1 Reply Latest reply on Jun 28, 2010 10:05 PM by $Nith$

    Need to add a user to a list in Execute Script

    Ashok Deivasigamani Level 1

      Hi Friends,

      I have a requirment in which i have to find the list of people who have rejected a task assigned to them. From the Task result collection output of the "Assign Multiple Task" component, I am able to find the universal Id of the participents who have approved and rejected the task. After finding the user with the Find User component, I need to add that user to a list and use that list for rsubmission of the task to those who have rejected. The below picture shows you the workflow.


      I have written a script which is correct in syntax, yet does not work after the first rejctor User object is added to the list. Please find the script bellow. Kindly help me in finding a solution on how to approch this task.


      import com.adobe.idp.dsc.um.lookup.datamodel.User;
      import java.util.List;
      import java.util.ArrayList;

      User rejector = patExecContext.getProcessDataValue("/process_data/rejector");
      ArrayList rejectorList = patExecContext.getProcessDataListValue("/process_data/listOfRejectors");
      patExecContext.setProcessDataListValue("/process_data/listOfRejectors", rejectorList);

      In the above script, you can see that the User object rejector(local to the script) is assigned with the "/process_data/rejector" variable. and a arrayList rejectorList(local to the script) is assigned with the "/process_data/listOfRejectors" which is an empty list at the bigining of the loop.

      The statement "rejectorList.add(rejector)" adds the rejector User value to the array list. and finally the rejectorList local variable is copied to the process variable "process_data/listOfRejectors". by the statement

      patExecContext.setProcessDataListValue("process_data/listOfRejectors", rejectorList);


      Kindly let me know is the above approch is correct. Or if there is a alternative way of creating a list of User objects.