Accessing the Activity Outputs in Repeat While True Loop
This feature is useful when an activity needs to use the loop feature to do batch processing or fetch multiple records by executing the activity multiple times. With each iteration of the activity, its output will available for mapping to the activity input.
For example, if a Salesforce query returns 200 records and a locator, the locator can be used by the next batch query. This locator can be mapped into the activity input by mapping the activity output from the previous iteration which contains the locator for the next record set or query. Hence when the next iteration of the activity runs, it fetches the next record indicated by the locator that was mapped to the activity input.
This feature is available in all activities that generate an output (have an Output tab).
To use this feature, follow these steps:
Procedure
- In the Loops tab, set the Type to Repeat while true.
- Set the Access output in input mappings to Yes. This allows the output of the activity iteration to be available in the Upstream Output for mapping. Now you can map your activity output to the activity input parameter.
- Enter a condition in its text box. The activity evaluates this condition before each run. If the condition evaluates to true the activity executes. Note that the output is only available in subsequent iterations after the first iteration. Since the activity output is not available for the first iteration, your condition must perform a check to see if it is the first iteration of the activity. For example, use $iteration[index]> 0 && isdefined($activity[SFQuery].output.locator) to begin your condition. The $iteration[index]> 0 checks to make sure that it is not the first run of the activity. The isdefined($activity[SFQuery].output.locator) function checks whether the output field exists.