A recent client project presented a scenario that many businesses require: aggregating data from the Opportunity to the Opportunity’s primary contact based on the Opportunity Type. We needed to account for the existing client data, as well as any future Records that would be created. It’s a request that might seem straightforward initially, but as many Salesforce experts know, nuances lie in the details. Read on to learn how Salesforce Flows delivered!

The Salesforce Roll-Up Roadblock

The direct approach for roll-ups in Salesforce is to use a standard Salesforce Roll-Up Summary Field. However, this is exclusively available for master-detail relationships. Our challenge here was that the objects in question didn’t have this type of relationship, immediately making the standard roll-up utility infeasible.

Triggers, Apps, or Flows?

With the native functionality out of the picture, we could dive into the code-heavy world of Apex triggers. Additionally, the AppExchange offers some excellent apps dedicated to this purpose. But, after weighing our options, we zeroed in on a Salesforce tool that’s been gaining momentum for its power and flexibility: Salesforce Flows.

Flows in Salesforce are more than just a process automation tool. They provide a platform for both admins and developers to design, craft, and deploy intricate business logic without always diving deep into code. The robustness of Record-triggered Flow Salesforce combined with the modular nature of Salesforce Sub-flow allows for a design approach that’s both efficient and maintainable.

Crafting the Salesforce Flow Roll-Up Solution

Building on the power of Flows, our solution was architected as follows:

  1. Legacy Data Handling: To manage existing data, we developer a Flow that is triggered when a Contact record is updated. We ran a one-time Contact update on the necessary records which fired this Flow and then subsequently a Sub-Flow.  The Contact Id was passed into the Sub-flow for processing.

  2. Addressing New Opportunities: Every New Opportunity triggered a Flow to run. This invoked the above-mentioned Sub-Flow, feeding it with the Primary Contact Id to utilize,

  3. Sub-Flow’s Logic: Here lies the heart of our solution. This Sub-Flow queried all relevant Opportunities linked to the specified Contact, aggregated the requisite data, and then seamlessly updated the Contact record.

Using Salesforce Flows allowed us to also account for record merges, and Opportunity modifications in which the Primary Contact was updated. 

In Conclusion: Embracing Salesforce Flows

Our journey from identifying the challenge to delivering a tailor-made solution reinforced one undeniable truth: the untapped potential of Salesforce Flows. With challenges that traditional tools can’t easily address, Flows rise as a formidable and flexible force.

As businesses evolve and requirements become more complex, tools like Flows allow us to adapt, innovate, and deliver. This project wasn’t just about creating an Opportunity Roll-Up Salesforce style; it was a testament to the adaptability and innovation that Salesforce Flows enable.

Learn More Here!

Salesforce Flows: Revolutionizing Automation (Blog Post)

I love Iman’s 2-part introductory class on Flows. 
Part 1
Part 2


Leave a Reply

Your email address will not be published. Required fields are marked *