The repeater component is a relatively new feature in screen flows.
A simple way to show its usefulness is through an example. Let’s imagine there’s a Payment object, which is related to the Opportunity. Rather than have your users click “Add” on the Payment related list, enter some data, and then click “Save & New”, you can offer an optimized screen flow with a repeater.
Let’s say the two fields that must be entered by a user are Payment Method and Payment Amount, and the rest can be derived. You
- Add a repeater component
- Insert a picklist component into the repeater for Payment Method
- Insert a currency component for Payment Amount
To prepopulate the repeater’s rows with existing records, you get all payment records in a previous step and then set the default values to
- Repeater.Payment Method = {!Get_Payment[$EachItem].Payment_Method__c}
- Repeater.Payment Amount = {!Get_Payment[$EachItem].Payment_Amount__c}
From there, users can add and remove rows, and update these fields as needed. Once they leave the screen element, you access its outputs using one of the following
- Repeater.AllItems
- Repeater.PrepopulatedItems
- Repeater.AddedItems
- Repeater.RemovedItems
The names are pretty self-explanatory, and I prefer to only use AllItems. It’s a collection that you can loop through to obtain the final values for each row in the repeater.
The takeaway
When used well, the repeater can save your users time and frustration.