The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Recommended

Combining Selected and Edited Data Table Rows in a Screen Flow (opens in a new tab)

You will learn why a Data Table's Selected Rows and Edited Rows outputs must be merged to get the chosen records with their updated values.

Why read this

You will also see two ways to do it: a single Transform element, which drops unedited selections, and a Loop with Collection Filter, which keeps every selected row.

  1. Loop over Selected Rows
  2. Collection Filter on edited Id
  3. Decision: match found?
  4. Assign edited Quantity
  5. Add row to new collection
Option 2 merges the two outputs by looping over the selected rows

The standard Data Table component in Screen Flow can return selected rows and edited rows as two separate collections. The Selected Rows output holds the records the user picked but not their edited field values, while the Edited Rows output holds the changed values whether or not the row was selected. Neither output alone gives the set of selected records with their updated values, and the component does not offer a single combined output.

The article’s example is a screen where users pick Price Book Entry records and enter a quantity for each, using a custom Quantity field. The author notes that a user can edit a row without selecting it, or select it without editing, so the two outputs must be merged to get the list the flow needs.

The first option uses a Transform element with the two outputs as sources, joined on Id. The Quantity must be mapped from the Edited Rows collection to get the user’s value. This is simple and needs no loops, but it performs an inner join, so a selected row with no edit is excluded. The article suggests this fits when every selected row is expected to be edited.

The second option keeps all selected rows. A Loop runs over Selected Rows, a Collection Filter finds any matching edited record by Id, and a Decision checks whether a match exists. If one does, an Assignment copies its Quantity; if not, the original values are kept. Each row is then added to a new collection. The author says this uses more elements but gives more control. The choice depends on whether unedited selections should be kept.

Read the original at Salesforce Time (opens in a new tab)

Worth reading?