Hi folks, in this post I’m going to discuss the Loop element in Salesforce flows.
Before we start with the topic, if you are new to Salesforce and want to know more about Salesforce flows and flow builders you can check out What is Salesforce Flow Builder and the Basic Building Blocks of Flow Builder
In this example, we are going to create a Screen flow. Create a “Get Record” element to fetch all the Account object records present in your Salesforce org.
Learn more about Salesforce Flow Bootcamp
Select the Loop element and provide details such as label, and description. Add collection variable to your flow element.
Collection variable stores all the records on which you are going to take action using a loop.
As you know that the get record element is similar to the collection variable hence we will select the get record element while creating the loop element.
Want to Learn Salesforce Flows? Checkout our Salesforce Flow Course
The loop will iterate all the Account object records which we are fetching from Salesforce org.
We can also set the order in which the loop should iterate over the collection items.
Learn Salesforce flow with free video tutorials
To understand how loops are implemented we are going to add a screen element with a display component to our flow.
As the records will be iterated, the Account name of each Account record will be displayed on the screen element.
BUSINESS SCENARIO: Add a Count field on the screen element to increase the count whenever the loop iterates the Account object’s record.
For more details about the Loop element and solution of the business scenario check out the video