ABSYZ ABSYZ

  • Home

    Home

  • About us

    Who We Are

  • Our Expertise

    What we Do

  • Our Approach

    How We Do It

  • Products

    What We Made

  • Industries

    Who We Do It For

  • Clients

    Whom We Did It For.

  • Article & Blogs

    What Experts Think

  • Careers

    Join The Team

  • Get In Touch

    Let’s Get Started

ABSYZ

Roll Up Summary using Flows

Home / Article & Blogs / Salesforce / Flows / Roll Up Summary using Flows
By Sangamesh Gella inFlows

Implementing roll-up summary fields using flows

How often have we wondered if there was a way to work some of the magic of Master-Detail in lookups as well! In most cases, the feature of the roll-up summary without having to change lookup to master-detail would top the list of such wishes. Unfortunately, the feature is not available for lookups out-of-the-Box. But, here we are to the rescue.

In this blog, we’ll take you through a series of steps that would help in imitating the roll-up feature in case of lookups with the help of Lighting Flows.

Limitations:
The OOB Roll-up summary works when there is a master-detail relationship between the objects.
Use Case:

A custom object named Pricing under Opportunity has a lookup relationship. Amount fields need to be rolled up as a sum whenever pricing is created or updated under the opportunity. Clients want to have an alternative that sums up the amount. We can achieve this by creating two flows: one triggers when we create or update a record and the other when we delete a record.

Let us deep-dive into the step by step process –

Creating the flow when creating or updating the records:

  1. Log in to the org and go to flows. Click on Create New Flow.
  2. Choose Record Triggered Flow from the “All + Templates” tab.
  3. We need to select when we want this to get triggered:
    1. Choose “a record is created or edited“ for Trigger the Flow.
    2. Choose “Action and its related records“ to Optimize the Flow.
  4. We need to get all the child records associated with a parent record. For this purpose, we need to use the Get Records element.
    1. Give the Label and Name
    2. We need to filter the records based on the Id value present on the child record to the parent record.
    3. Get all the records.
  5. We need to loop over the records to perform the operations we need to do:
    1. Use the Loop element and add the “Get Records” API name in the collection variable.
    2. Specify the direction from First Item to Last Item.
  6. Now create a variable that stores the value from the child’s record – this operation must be done with the Assignment element.
    1. Create a variable by clicking a new resource and selecting resource type as variable
    2. Give the variable an API name and currency as data type.
    3. As we need to get the sum of all records for the specified field, choose the operator as ADD.
    4. Assign the value with the field name you need to get the sum from the current loop.
  7. Now, here comes the final part of updating the records. After all iterations, we must update the parent object with child field values.
    1. Add an element of Update Records and label it.
    2. As we update parent fields, select “specify conditions to identify records and set fields individually”.
    3. Select the parent object and filter the records based on the parent’s record Id present in the child object to that of the child’s record.
    4. Choose the field name you want to update, and the value should be the variable name given in the assignment.

Creating the flow when deleting the records:

  1. Log in to the org and go to flows. Click on Create New Flow.
  2. Choose Record Triggered Flow from the “All + Templates” tab.
  3. We need to select when we want this to get triggered.
    1. Choose  “a record is deleted”  to Trigger the Flow
    2. Choose “Action and its related records” to optimise the Flow.
  4. We need to get all the child records associated with a parent record. For this purpose, we need to use the Get Records element.
    1. Give the Label and Name
    2. We need to filter the records based on the Id of the parent’s record present in the child to that of the parent Id.
    3. Get all the records.
  5. We need to loop over the records to perform the operations we need to do.
    1. Use the Loop element and add the “Get Records” API name in the collection variable.
    2. Specify the direction from First Item to Last Item.
  6. We can use the Before delete operation to deduct the pricing value. But what happens is the calculation will not update, and the data will be wrong.
  7. To avoid this issue, we need to capture the sum of all the records for the specified record. Create a variable that stores the value from the child’s record – this operation must be done with the Assignment element.
    1. Give the label and API name for the element.
    2. Create a variable by clicking a new resource and selecting resource type as variable.
    3. Give the variable an API name and currency as data type.
    4. As we need to get the sum of all records for the specified field, choose the operator as ADD.
    5. Assign the value with the field name you need to get the sum from the current loop.
  8. Now that we have the sum of the records, we need to create another Assignment element that subtracts the value of the deleted record from the sum.
    1. Use the same variable.
    2. As we need to get the difference between the computed sum and the deleted record, choose the operator as SUBTRACT.
    3. Assign the value with the field name you need to get the difference from the current loop.
  9. Now here comes the final part of updating the records of the parent object with child field values.
    1. Add an element of Update Records and label it.
    2. As we update parent fields, select “Specify conditions to identify records and set fields individually”.
    3. Select the parent object and filter the records based on the parent’s record Id present in the child object to that of the child’s record.
    4. Choose the field name you want to update, and the value should be the variable name given in the assignment.

Please click on the below link to see the working in action:
Roll-up summary using flows in action

roll-up summary fields using flows
51
Like this post
3 Posts
Sangamesh Gella

Search Posts

Archives

Categories

Recent posts

Meet OmniStudio – Revolutionize Your Creative Work

Meet OmniStudio – Revolutionize Your Creative Work

BioAsia 2023 in Hyderabad: An Annual International Event

BioAsia 2023 in Hyderabad: An Annual International Event

The Role Of Marketing in Small & Medium Enterprises

The Role Of Marketing in Small & Medium Enterprises

Salesforce For Retail: How Salesforce CRM Can Help Retailers

Salesforce For Retail: How Salesforce CRM Can Help Retailers

What is ChatGPT & How Does It Work?

What is ChatGPT & How Does It Work?

  • Multiple Lead Converter: Making Lead Conversions Hassle Free
    Previous PostMultiple Lead Converter: Making Lead Conversions Hassle Free
  • Next PostPassion and courage to experiment
    Multiple Lead Converter: Making Lead Conversions Hassle Free

Related Posts

Salesforce Winter ’23 Release: Major Flow Builder Updates Part – 2
Flows Salesforce

Salesforce Winter ’23 Release: Major Flow Builder Updates Part – 2

Salesforce Winter ’23 Release: Flow Builder Updates Part – 1
Flows Salesforce

Salesforce Winter ’23 Release: Flow Builder Updates Part – 1

How Salesforce Flow Simplifies and Speeds Up Workflow Automation?
Flows Salesforce

How Salesforce Flow Simplifies and Speeds Up Workflow Automation?

Leave a Reply (Cancel reply)

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

*
*

ABSYZ Logo

INDIA | USA | UAE

  • About us
  • Article & Blogs
  • Careers
  • Get In Touch
  • Our Expertise
  • Our Approach
  • Products
  • Industries
  • Clients
  • White Papers

Copyright ©2022 Absyz Inc. All Rights Reserved.

youngsoft
Copy
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “ACCEPT ALL”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent. Privacy Policy
Cookie SettingsREJECT ALLACCEPT ALL
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.

CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.

Functional

Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.

Performance

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

Analytics

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.

Advertisement

Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.

Others

Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.

SAVE & ACCEPT