Loading...
New Winner – Cross-Border Excellence | Payoneer India 2026 Check out
Featured Recognized by Salesforce; Proven by impact! Check out

Wouldn’t it be much easier for you if you could calculate the average number of closed opportunities in Salesforce? This solution is here to make things easier. A rollup summary in salesforce a field that allows you to calculate values from related records. For instance, you want to calculate the average number of closed opportunities, the average amount of closed opportunities, or the SUM, MIN, MAX number. Today, we are going to tell you how you can create rollup summary in Salesforce with flow. So, let’s just jump right into the steps!

Steps

Use Case

Here is a simple example of how to create a roll-up summary that counts how many contacts exist for a given account and keeps this number up-to-date as you add/edit contacts that are related to this account.

Create a new Account field

Starting with the Account object (where we want our counter), we create a new number field (with 0 decimal places) called Contacts Count (Contacts Count__c).

create rollup summary in Salesforce 1

To start building this flow, create a new flow, type = Record Triggered Flow.

The object is the contact as we want to see when a change occurs on a contact record. For example, it gets related to an account. We need to do this after the contact record is saved.

create rollup Summary in Salesforce

Unfortunately, there are no filters on the contact that we can use to determine if we need to update the account contact count, so we have to check them all. It’s not a very efficient method, but it only runs when we create or update a contact record.

The ideal situation would be to only update those where the record is new or the AccountId has been added or changed. Using the changed operator would like the solution. However, it will always be true when we create a new contact as the AccountId will go from null to a valid AccountId.

create rollup Summary in Salesforce

Add a Decision element:

Now, we can add a decision to see if the AccountId has been changed. The Yes condition is for an existing contact record where the related Account (Account ID) has been changed.

create rollup Summary in Salesforce

Add a Get Records element (for Prior accounts):

Here, we want to get any contact records where the Account Id was changed on the contact. We need to update this account contact because the record may no longer be related to the account and the count needs to be recalculated.

We want to count any contact records where the Account Id is the same as the contact record that triggered this flow – before the change (they were related to the same account).

create rollup Summary in Salesforce

First, we need to create a variable to save these records to:

create rollup Summary in Salesforce

Click on New Resource to create a variable.

create rollup Summary in Salesforce

Create another variable rc_ContactsPrior

create rollup Summary in Salesforce

Back to the get records element:

create rollup Summary in Salesforce

ContactsCounterPrior variable:

Create another variable to store how many contacts were found:

create rollup Summary in Salesforce

before

Create an Assignment Element

Set our new counter to the number of contact records we found.

create rollup Summary in Salesforce

Add an Update Records Element:

Next, update the account record with the new count of contacts:

create rollup Summary in Salesforce
create rollup Summary in Salesforce

Get our contacts:

create rollup Summary in Salesforce

Add the fields we want in our record collection:

create rollup Summary in Salesforce

Create another new variable for the count of records:

create rollup Summary in Salesforce

Assign the value to the counter: (add Assignment)

create rollup Summary in Salesforce

Update our Account with the new counter value:

create rollup Summary in Salesforce
create rollup Summary in Salesforce

Save your Flow

Finally, Save and activate your flow and check if your flow looks like the one in this pic:

create rollup Summary in Salesforce

Conclusion

We hope that you liked this blog and now you can create your own roll-up summary with the flow in Salesforce. If you try out this solution, then do share your experiences with us. We will be back with another interesting blog soon.

Also, you can follow us on our social media handles to stay updated about all the latest developments in and around Salesforce. Till then, happy learning! πŸ™‚

No Data Found.

Related Articles
From SMBs to Enterprises: Why Salesforce CRM Remains the Choice for Every Business Size

Running a modern business requires a robust Salesforce CRM platform that connects teams, organizes customer data, and delivers real-time operational insights. In today’s competitive environment, waiting for information across disconnected systems is no longer practical, especially when modern buyers expect immediate responses across every channel. For years, the software was primarily associated with large corporate […]

Read More
How to Integrate NikoHealth to Salesforce

Healthcare organizations using NikoHealth often need patient, insurance, order, invoice, and prescription data available inside Salesforce. As data grows, manually updating records across systems becomes difficult and can lead to delays, duplicate work, and data inconsistencies. NikoHealth to Salesforce integration helps solve this challenge by automatically synchronizing data between both platforms. Instead of building custom […]

Read More
Flow Orchestrator vs. Traditional Flows: When to Use Each for Salesforce Automation

Businesses use Salesforce automation to reduce manual work, improve efficiency, and automate repetitive business processes. Two commonly used automation approaches inside Salesforce are Traditional Flows and Flow Orchestrator. Traditional Flows are mainly used for simple automation tasks such as updating records, sending notifications, creating tasks, and automating business logic. Flow Orchestrator is designed for more […]

Read More
The Rise of Agentic Government: How AI Agents Are Transforming Public Services

Government technology has often been seen as slower to evolve than the private sector. But Salesforce’s latest research challenges that idea in a big way. In fact, the new findings suggest that public sector organizations may now be moving faster than many businesses when it comes to adopting AI agents and preparing for a more […]

Read More
How To Use Email Service in APEX

Managing approvals, updates, and record changes directly from email can significantly improve efficiency within Salesforce workflows. Instead of logging in, navigating records, and manually updating fields, users can simply respond to emails and trigger automated updates using Email Service in APEX. This approach is especially useful for businesses leveraging Salesforce automation and looking to enhance […]

Read More
Design and Implementation of Salesforce-Jira Task Integration

Businesses have been using Salesforce for CRM operations and Jira for Agile project tracking. However, without integration, teams manually update both systems, leading to data inconsistency and inefficiency.This mechanism establishes a real-time integration between Salesforce and Jira, allowing seamless synchronization of tasks and agile board statuses.Β  A custom Salesforce dashboard was developed that replicates Jira-style […]

Read More
Our Location worldwide
Indian Flag India
7th Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203669505
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
CA Flag Canada
HIC Global Solutions INC
6D - 7398 Yonge St #1124 Thornhill, ON L4J 8J2 Canada +1(262) 310-7818