Scripts can be associated with processing loops in the Properties view for the task to which a loop has been applied.
Procedure
On the
General tab of the Properties view for the task, select either
Standard Loop or
Multi-instance Loop.
Note: When using a multi-instance loop, you should set an additional instance expression which must evaluate to 0. When the loop has finished it looks to see if this exists. If you do not set this to 0, then your multi-instance loop will not be able to end.
When either of these is selected the
Loops tab becomes available. Select JavaScript from the
Script Defined As: field and enter the script itself in the area provided.