Adding iteration to a flow

You can use the Split For Each shape to create a loop in a flow that iterates over a group or list of pages. By using iteration, you can apply the same logic to information that varies in size from case to case.

  1. Ensure that the loop limits for your production level can support your flow.

    1. Open the MaxFlowLoopCount System setting by searching for it or by using the Records Explorer.

    2. On the Settings tab, review the limit value for the production level of your system.

    3. If the number of pages that you plan to process in your flow exceeds the limit value, increase the number in the Value column.

      Loop limits are enforced by your application to prevent flows from entering infinite loops.

  2. Add the Split for Each shape to your flow.

    1. Open a flow by searching for it or by using the Application Explorer.
    2. On the Diagram tab, click the Flow shapes icon, and then click Advanced > Split For Each.

    3. Drag the Split for Each shape to a position on the flow diagram, based on the order of events in the flow.

    4. Connect the Split for Each shape, by dragging connector end points to connection points on different shapes in the flow.

  3. Define how the flow iterates over information in a case.

    1. Double-click the Split for Each shape to open the property panel.

      Some of the following options are not available for screen flows.

    2. In the Join list, select Iterate.

    3. In the Page property field, press the Down Arrow key and select a property that stores a group or list of pages.

      CAUTION:
      Do not change the structure or indexing of the pages in this property, because it can lead to unexpected results.
    4. In the Class field, enter the class name that your application uses to find the page property, the flow tt runs for each page in the page property, and any conditions that you define.

    5. In the Flow name field, press the Down Arrow key and select a flow that runs on each page in the page property.

    6. To control whether the flow runs for all or some pages in the page property, press the Down Arrow key in the When field, and then select a when condition that evaluates values in each page.
    7. To control whether the Split For Each shape evaluates all or some pages in the page property, press the Down Arrow key in the Exit iteration when field, and then select a when condition in the same class path as the parent flow.

      For example, you can stop processing a list of votes after you reach the number of yes votes that constitutes a majority.

  4. Control the order in which your flow processes pages in a group.
    1. In the Page group iteration settings section, click + Add condition.

    2. In the Subscript order field, enter text that your flow compares with the subscript value for each page in the group.

      By default, your flow determines whether the subscript value contains the text that you provide.

    3. To ignore the pages in the group that do not match the subscript order that you provide, clear the Process remaining changes check box.

      Otherwise, your flow evaluates these pages after it processes all conditions in the Page group iteration settings section.

  5. Click Submit to close the property panel.

  6. Click Save .