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.
User rejector = patExecContext.getProcessDataValue("/process_data/rejector");
ArrayList rejectorList = patExecContext.getProcessDataListValue("/process_data/listOfRejectors");
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
Kindly let me know is the above approch is correct. Or if there is a alternative way of creating a list of User objects.
You can choose any one of the following two approaches:
1. Inside your script activity use the method appendToProcessDataListValue to append a rejected user to the list variable
2. Use a SetValue activity instead; This is more efficient as the logic is straight forward.
I prefer approach #2.