Are you looking for a tool to help you easily manage repetitive tasks in Salesforce? Look no further than the Repeater component! This component allows you to reference the output of one element in another within the Repeater, making data management smoother.
It also includes features such as conditional field visibility and input validation to ensure your data is accurate and consistent.
Debugging has become more convenient with the Repeater component. It provides you with all the necessary information about the Repeater element directly from the debugger, which makes troubleshooting effortless.
Besides, the Repeater component responds in real-time to user input, offering a more dynamic and responsive experience.
Business Scenario:
Create multiple Contact records using the Repeater Component.
Configure Screen Flow:
Log in to your Salesforce org or you can sign up for the pre-release org here
Create New Flow:
Navigate to Setup and create a new Flow.
Start Creating from Scratch and select Screen flow as the type of flow.
Add Screen element:
Drag and Drop the Repeater Component on the Screen.
To get input for First Name and Last Name, we can either drag and drop the “Text” component from the components or directly use the “Name” component.
When we use separate text components for first and last names, we can make the fields required as shown below.
Directly use the Name component and drag and drop the email component. You will see the final screen as shown below. Provide the repeater component API name as ‘Contacts’.
After creating the repeater element, navigate to the Toolbox and choose “Contacts” from the Screen Components. The type should be List.
To Check how the repeater Component works please debug the flow.
Once you Debug the Flow, we can see the Screen below. To add multiple records click on the “Add” button.
Create some Test Contacts as shown below and click on Finish.
In Debug Details we can see Collection as a List.
When we copy and paste this JSON code into any JSON formatter, we see Contacts as a list as shown below.
When creating the Repeater Component, we did not specify the sObject type, so we cannot immediately use the Create Record Element.
Add Loop Element:
Give a label and Name to the Loop Element. In Collection Variable we can see Repeater Screen. Once Selecting it we can also see Contacts and All Items. Select them.
For each path: Add the assignment element and Create a Contact variable in it using New Resource.
Set the Variable Values as shown below:
- {!ContactRecord.FirstName} Equals {!Con.Name.firstName}
- {!ContactRecord.LastName} Equals {!Con.Name.lastName}
- {!ContactRecord.Email} Equals {!Con.Email.value}
Create a Collection Variable to store the Contact information using “Add Assignment”. Mark the checkbox for “Allow multiple values” as checked.
Assign variable value as {!conCollection} Add {!ContactRecord}. This is what your final Assignment element looks like.
Finally, Add the create record element.
Want to Learn Salesforce Flows? Checkout our Salesforce Flow Course
This is what the Final flow using the Repeater Screen Component looks like.
Also read- Salesforce Summer’ 24 Flow Updates
Debug the Flow:
Save and Debug the flow to Check how the Repeater Component works to Create multiple records.
Once we navigate to Contact we can the Contacts are created using the Repeater Component in Screen Flow.
FAQs
1. What is the Repeating section in Salesforce Flow?
This feature allows you to create a section on a screen flow that repeats based on certain criteria. You can place various fields within the repeater, enabling users to enter data for multiple records in one go.
2. How do we control how many times the Repeater section appears?
There are two ways. You can set a pre-defined number of repetitions, or you can allow users to dynamically add or remove sections as needed using the “Add Row” and “Remove Row” buttons.
3. What happens to the data collected in the Repeater?
Once users complete the flow, the data from each repetition is stored in a collection variable. You can then use this collection to perform actions like creating multiple records or updating existing ones.
4. What kind of data can we capture in a Repeater?
You can add various fields within the Repeater, including text inputs and picklists. This lets you collect all the necessary information for multiple records in one go.
Conclusion:
Salesforce Flow’s Repeater component has been a revelation! With the ability to create multiple records at once, our processes have become much faster and smoother. This innovative feature has saved us a lot of time, allowing us to focus on what matters: providing excellent service to our clients.
One thought on “Repeater Component in Salesforce Flow”