Get activities within a loop
Use the getActivity() call to retrieve an activity.
For example, the following call retrieves the supervisor approval activity associated
with the third iteration of the loop:
theActivity = process.getActivity(“SupervisorApproval”,3);
The following call retrieves the service owner approval activity that is not part of a loop:
theActivity = process.getActivity(“ServiceOwnerApproval”);
An instance of an activity is not available for retrieval with process.getActivity() until the activity actually runs in the loop. You might have a loop condition that specifies that a loop runs three times or until another condition is met. It is possible that the third iteration of the loop does not run. In this case, a script that runs the following line of JavaScript code after the loop returns a null value.
theActivity = process.getActivity(“SupervisorApproval”,3);
Accessing the Activity with a null value causes errors to occur.