Automation Champion

Automating Salesforce One Click at a Time
Automation Champion
  • Home
  • About Me
    • Testimonials
    • Resources
  • Process Builder
  • Salesforce Flow
  • Pardot
  • Apex
  • Training Details
    • Salesforce Administrator
    • Salesforce Advanced Administrator
    • Platform App Builder
    • Lightning Flow
    • Pardot
    • Sales Cloud
    • Service Cloud
    • Community Cloud
    • Hands-on Excercises
  • My Books
  • Contact Me
  • Tag: Count records in Salesforce

    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)

      Posted at 9:10 AM by Rakesh Gupta, on July 17, 2018

      Salesforce Flow allows us to automate business processes by building applications, known as Flows. Using Flows, a user can collect information; or, they can update, edit, or create records in Salesforce. Furthermore, Flows can execute logic, interact with the Salesforce database, call Apex classes, Platform Events, and guide users through various screens to streamline the process of collecting and updating data. 

      Once a Flow is built, an Admin can make the Flow available to the right users or systems.

      If you have a basic understanding of Apex then, you can write a query to get records and count the list size. For example, using Apex, one can get all Contacts that belong to city Alpharetta and, count list size, by writing the following code:

      List<Contact> myContact = new List<Contact>();
      myContact = [Select id, Email from contact where Mailingcity ='Alpharetta'];
      system.debug('Size of List'+myContact.size());

      Now suppose you wonder, can I achieve the aforementioned outcome by using Flow? Well, you are in luck! For, before the recent release, it was very complex to count the records in a Record Collection Variable (Kind of equivalent to Apex list). 

      Count Records in a List

      But, since Spring’18 release, a user can use an Assignment element to count the Record Collection Variable size and store that number in a variable without using the Loop element! 

      Business Use Case

      Edward Backhouse is working as a System administrator at GurukulOnCloud. He received a requirement to count Contact records where Mailing city equals Alpharetta. The new feature of Flow to rescue! 

      The solution for the above business requirement

      There are a few possible solutions for the above business scenario. One of them, of course, is to continue to use the old method, as shown in the preceding screenshot. 

      But, Edward is a Salesforce Ninja-like us! And, therefore, he is always on the lookout for feature enhancements. As a result, Edward knows that, after Summer’18, he can solve the above requirement efficiently! So, instead of resorting to the old method, he takes following the steps:

      1. Edward navigates to Setup (Gear Icon) | Setup | Process Automation | Flows in Lightning Experience.
      2. Then he clicks on the New Flow button – which, in turn, opens the Flow canvas.
      3. Edward creates a Variable (to store record count) as shown in the following screenshot:
        Read the rest of this entry!
      Posted in Salesforce Flow | 6 Comments | Tagged Count Number of records in Flow, Count Number of records in Salesforce, Count Number of records in Visual Workflow, Count records, Count records in Flow, Count records in Lightning Flow, Count records in Salesforce, Count records in SObject Collection Variable, Count records in SObject Collection Variable Flow, Count records in SObject Collection Variable Lightning Flow, Count records in Visual Workflow, Flow builder, Flow Trails, Platform App Builder Exam, salesforce Admin exam, Salesforce Flow, Salesforce Flow Example, Salesforce Freelancer, Salesforce Independent Architect, Salesforce Independent Consultant, Salesforce Online Training, salesforce trainer, Salesforce Training, Trailhead
    • Search

    • Upcoming Trainings

      Salesforce Administrator Certification
      Salesforce Advanced Administrator Certification
      Salesforce Platform App Builder Certification
      Lightning Flow & Process Builder
      Advanced Lightning Flow
      Pardot Specialist & Consultant Certification
      Sales Cloud Consultant Certification
      Service Cloud Consultant Certification
      Community Cloud Consultant Certification
    • Sponsor #1

    • Sponsor #2

    • Sponsor #3

    • Sponsor #4

    • Order Now!

    • Buy My Book

    • Buy My Book

    • Recent Posts

      • Getting Started with Salesforce Flow – Part 59 (Clone a Chatter Group with Members)
      • New Research: Salesforce Delivery Teams Excel in Speed but at the Expense of Quality
      • Improve Your Data Collection Strategy with Web Forms
      • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
      • Advancing Business Operations with Salesforce and QuickBooks
    • Salesforce ID Converter Build on Lightning Flow

      Converting 15 digit ID to 18 digit Salesforce ID
    • Blog Archives

    • Categories

  • Information

    • About Me
    • Affiliate Disclaimer
    • Contact Me
    • Privacy Policy
  • Top Posts

    • Learning Flow
    • Learning Process Builder
    • Getting Started with Salesforce Flow – Part 43 (Dynamic Approval Routing in Salesforce)
    • Getting Started with Salesforce Flow – Part 57 (Adding Validation to Flow Screen Components)
    • Getting Started with Salesforce Flow – Part 59 (Clone a Chatter Group with Members)
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Salesforce Flow – Part 24 (Automatically Assign Permission Sets to New User)
    • Getting Started with Salesforce Flow – Part 1 (Understand, Create & Use Variables in Flow!)
    • Salesforce Spring’21 Release Quick Summary
    • Getting Started with Process Builder - Part 1 (Automatically Create a record)
  • Social Media

    • View Automationchampion’s profile on Facebook
    • View Automationchamp’s profile on Twitter
    • View Rakeshistom’s profile on GitHub