Use Summer ’21 Flow Collection Sort to Label Top Ten Donors

Broad use case: Use the new Collection Sort feature in Flow to find a specific number of records that meet your criteria, and sort them with one or more criteria (criterion?)

Example use cases: I want my top 3 open opps to have a giant dollar sign image on them or I want to automatically nudge/shame the five users who logged in least last month or I want to focus a campaign on my most active volunteers in the summer.

Our specific case: I want to look at a contact record in Nonprofit Success Pack and see immediately that they are one of my top ten donors.

Install this unmanaged package to try it out.

Quick overview of what the package contains:

  • One custom field: Donor__c that has a picklist value of “Top Ten.”
  • Flow One: Top Ten Donors
    • This Flow uses the Summer ’21 Release feature “Collection Sort” to label our top ten donors
  • Flow Two: Image Top Ten
    • This displays an image on the Lightning record page if the donor is in the top ten! I just realized you could do this.

Detailed overview:

  • One custom field: Donor__c that has a picklist value of “Top Ten.”
  • Flow One: Top Ten Donors
    • This Flow uses the Summer ’21 Release feature “Collection Sort” to label our top ten donors
    • The first half of the flow finds all the currently labeled “Top Ten” contacts and removes that label.
    • Then I use a “Get Records” to find my donors whose Total Gifts are greater than or equal to $10,000 (just to narrow down the size of the collection). Modify that number to meet your own needs.
    • Then I use the new Collection Sort element to find my top ten records of that collection.
      • I sort the collection I just created by Total Gifts in Descending order.
      • Notice how I can add another level of sorting! I can say sort by closed date and then sort by total gifts or something like that.
      • I limit the size of the collection to get the top ten.
    • Then another flow loop updates those ten records to say Top Ten.
    • This Flow only runs when you hit RUN. Maybe it could run on a schedule.
  • Flow Two: Image Top Ten
    • I just realized that I can display an image conditionally on a Lightning record page using a flow and component visibility! I love this!
    • The entire flow is a just one screen displaying the Top Ten image.

Required Set Up for the Image

  • Modify your Lightning page layout for Contacts.
  • Add a Flow component to the page with the Image Top Ten flow.
  • Use component visibility to filter on the record field when Donor__c = Top Ten.

Running the Flow

This flow isn’t scheduled to run at any particular time or when any record changes or is created. As is, it needs to be manually run.

Published by

JessieRymph

Jessie joined Salesforce.org in 2018 to give introductory webinars to nonprofit customers. She now is a Senior Solution Developer supporting nonprofits and education customers at Salesforce. All opinions expressed on this blog are her own or those of the contributors. She's spent 17 years more or less in CRMs and databases, but didn't meet Salesforce until 2011. Jessie co-led the Seattle Salesforce Nonprofit User Group in 2015-2016. She wrote a sh*tty first draft of a novel and hopes to turn it into a screenplay!

Leave a Reply