Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Send Edited Record Grid Rows to Apex or a Decision

Use what users changed in a Record Grid after the screen: skip a step when nothing changed, loop over the edited deals, or pass them to an Apex action.

Once the sales manager has adjusted the three deals, the flow can act on what she changed. It can skip the approval request when she changed nothing, collect the deals she moved to Negotiation/Review, or hand the edits to an Apex class that recalculates the discount. Record Grid writes her edits to three output variables each time she clicks Save.

Flow Builder canvas with a Deal Comparison screen followed by an Assignment that counts the edited deals, a Decision, a Loop over the edited deals and an Apex action
After the screen, the flow counts the edited deals, branches, loops over them and calls Apex.

Before you start

  • An editable Record Grid on Opportunity records, with at least one row marked Editable. Edit and save values in a Record Grid sets up the editing and the Save interaction.

  • For the Apex step only: an invocable Apex class, written and deployed by a developer.

The three output variables

Output variable
Type
What it holds

Edited Rows

Record collection (Opportunity here)

One record per edited deal, with its Id and only the fields that changed.

Edited Rows Full Data

Record collection (Opportunity here)

The same records with every value the grid loaded, edits included.

Edited Rows Serialized

Text

Edited Rows as a JSON array: one object per edited deal, with Id and the changed fields under their API names.

When they are written:

  • Every time the user clicks Save in the grid footer. Each Save lists every deal edited since the screen opened, not only the latest changes.

  • Cancel writes nothing. The outputs keep the values of the last Save, and stay empty if the user never saved.

  • They are written as soon as the user clicks Save, before Update Record(s) returns. If that save fails, they still hold what the user entered.

Steps

1

Make sure the user saves before leaving the screen

The outputs are filled only by Save. Wire the grid so that a successful save moves the flow to the next screen (Flow Navigation under On Success of Update Record(s)), as shown in Edit and save values in a Record Grid.

2

Count the edited deals

After the screen, add an Assignment element:

  • Variable: a new Number variable, editedDealCount, with 0 decimal places.

  • Operator: Equals Count.

  • Value: the Record Grid's Edited Rows (in the resource picker, open the grid's API name, Deal_Grid, then pick Edited Rows).

3

Branch on whether anything changed

Add a Decision element with an outcome named Deals Changed: editedDealCount Greater Than 0. The default outcome is the path where the manager changed nothing, so the flow can skip the approval step there.

4

Loop over the edited deals

On the Deals Changed path, add a Loop on Edited Rows Full Data. Inside it, a Decision tests the current deal, for example StageName Equals Negotiation/Review, and an Assignment adds the matching deals to a collection for the approval request.

Loop on Edited Rows Full Data here, not Edited Rows: in Edited Rows, a field the manager did not change is empty, so a test on Stage fails for a deal where she changed only the Amount.

5

Pass the edits to an Apex action

Add an Action element and pick the Apex action. Map its input to Edited Rows when the class only needs what changed, or to Edited Rows Full Data when it needs the whole record. The developer's class receives the records like this:

Use Edited Rows Serialized when the destination takes text instead of records: a Long Text Area field that keeps an audit trail of the edits, or an action that sends them to another system.

6

Save and test

Debug the flow.

  1. Change the Amount of one deal and click Save. On the next screen, the debug details show editedDealCount at 1 and the flow takes Deals Changed.

  2. Restart, change a value, click Cancel, then Next. editedDealCount is 0 and the flow takes the default outcome.

To save the records after the screen instead of inside the grid, leave Update Record(s) out of the Save interaction and add an Update Records element on Edited Rows. Since Edited Rows carries only the changed fields, only those fields are updated. The user then has to click Save in the grid footer before Next.

Troubleshooting

Edited Rows is empty after the screen

The user left the screen without clicking Save in the grid footer, or clicked Cancel. The flow's own Next button does not save the grid. Wire Flow Navigation under On Success (step 1) so a save moves the screen on.

A field is blank in Edited Rows

Edited Rows carries only the fields the user changed. Read Edited Rows Full Data when you need the other values.

Edited Rows lists a deal the user did not change in the last save

Each Save reports every deal edited since the screen opened. A deal saved in an earlier click is still in the list.

Was this helpful?