The Loop through Grid action is used to apply a number of actions to select records displayed within a grid, including its multiple pages.
This is used instead of Loop through Table when it's important to preserve the view filters and search terms of the Method user. It also allows the user to select a subset of rows within the grid.
▶ Select a grid: a grid, available on the current screen, to loop through.
▶ Only select rows that are checked: Normally, the loop will go through the entire grid, taking into consideration the filter and search criteria. Checking this, you can further filter the grid by only using the rows that are checked.
- Actions are embedded within the Loop Through Grid action. This is indicated by indented actions marked by a blue line. In the below image, there are two actions inside of our Loop Through Grid action: Assign Value to Action Result action and Update Fields in Table action. The Show Message action is outside of the loop.
- The Loop Through Grid action will go through each record in sequence and applies all of its embedded actions to that row.
- If Only select rows that are checked is not selected, this action will loop through all the records in the grid. If the grid has multiple pages, the action will go through all the pages. Remember, however, the view filters are preserved.
- To add a new action to the Loop Through Grid action, hover over the action. The “⊕” plus sign will add an action indented within the Loop Through Grid action. You can also drag and drop other actions within the Loop Through Grid action.
- Actions embedded within the loop will have access to the data of each row. Note in the below example action, I can pull values from grid columns of the Loop.
In this example, the action is set up to go through all the records in a grid with a yes/no field called IsActive.
Embedded in the loop is another action, Update Fields in Table. Note the blue vertical line which groups it to the Loop.
Within Update Fields in Table action, you can set the criteria to compare values to what is available from the grid loop.
The Update Fields in Table function will take the action result and update the field in the table.
The complicated part is letting the action know which record to update. Going back to the Criteria Builder, you want the RecordID of the table to match the RecordID of the Loop. Notice the right dropdown now has a subset called Loop? This subset of fields only appears if the action is embedded in a loop. Make sure the proper RecordID fields are being compared.