Skip to main content
All CollectionsSwantide Workflows
Count the Number of Associated Records to an Object via a Lookup Field
Count the Number of Associated Records to an Object via a Lookup Field

This article will walk you through how this Swantide Workflow accomplishes roll-up type functionality to count lookup field associations.

Engineering Swantide avatar
Written by Engineering Swantide
Updated over a year ago

How it Works:

  • This Workflow will deploy a flow to count the # of records associated to another. "parent" object

  • When deploying this Template, you will choose the lookup field that represents the association to another record

  • Then, the flow will look up the amount of times across all records that record is used in that lookup, this number will then be displayed on the parent record

Example:

  • Variable Input 1: Choose the lookup field that relates the records

    • Object: Account

    • Field: Referral Account (lookup on Account records)

  • Variable Input 2: Choose the field to house the total count of records

    • Object: Account

    • Field: Total # of Referrals

In this case, let's say we have a Referral Account called Stark Industries who has already referred 7 Accounts. When another Account record is added called Hulk Co, that lists Stark Industries as its referral Account, this will be added to the total count of associated records that will be displayed on Stark Industries field for Total # of Referrals, which is now 8.

Further Customizations:

In some cases, our customers want to add additional customizations to this Swantide Workflow after it's deployed, to add in a filter on the # of records counted, you can take the following steps:
โ€‹

  1. As an Admin, login to Setup > Navigate to "Flows"

  2. After the Workflow is deployed, Navigate to the new Flow - this will follow the API naming convention: Swantide_Rollup_Associated_OBJECT_FIELD_Information, where the object and field information are taken from the lookup field chosen (in the example above, this would be called Swantide_Rollup_Associated_Account_Referral_Account_Information

  3. Click on the Flow and Navigate to the "Get All Associated Records" Step in the flow

  4. Double click into the Get All Associated Records, then this is where you will be able to add in additional conditions if you would like to limit the # of records counted. Add in the logic by choosing the field and conditions that you'd like to limit it to, then click save (demoed in the video below - adding in Conditions to only count the # of Contacts that are marked as having a Status of "in touch")

  5. Ensure that you choose the "Save As" button on the Flow and Click Activate

Did this answer your question?