In Salesforce, a roll-up summary field calculates values from related records, such as those in a related list. This field displays values in a master record based on the values of fields in a detailed record. With the help of flow, we can automate the process of creating a Roll-Up Summary field.
In this Salesforce tutorial, we will learn to Create Roll-Up Summary Field using Salesforce Flow.
Prerequisites
To create a Roll-up summary field using flow in Salesforce, you must have a custom Number field in the object in which you want to create the roll-up summary field flow.
Create Roll-Up Summary Field Using Salesforce Flow
In this example, we will create a Roll-up summary field in the Account object, which will display the current number of contacts associated with that Account record.
To Create a Roll-Up Summary Field With a Salesforce Flow, we will create an Auto-Launched flow that will be a sub-flow of a record-triggered flow.
We will call this auto launch flow with record trigger flows for different criteria like trigger flow when contact is created and another when the record is deleted or updated.
Now navigate to the setup page of Salesforce, and follow the below steps.
1. On the setup page, go to the Quick Find box and search, then select Flows under the heading Process Automation.

2. In the Flows setup window, click on the button New Flow.
3. Select the option Auto-Launched Flow and click on the Next button.

4. In this flow, we will create a variable to store the parent record ID. To do so, click on the toggle icon at the left and click on the button New Resource.

5. Enter the below details to create the variable for storing the Account ID.
- Select the Resource Type as a Variable.
- Enter API Name as accountId.
- Select Data Type as Text.
- Make the variable available for input and click Done.

6. In the same way, create another Resource with the below details that will count the records for the roll-up summary field.
- Select the Resource type as Variable.
- Enter the API Name as Count.
- Select the Data type as Number and better to keep Decimals as 0.
- Make this variable available for input and click the Done button.