FLOW: Display Prioritized and Counted Cases on an Account
Anna Szabo, JD, MBA
29x Salesforce Certified Golden Hoodie Award Recipient Working at Salesforce as a Customer Success Manager for Public Sector Federal Civilian | Previously Worked on the Product Team with 19x Salesforce Partners
Imagine an account that has 78 cases and you want to know how many of high priority. Would you like to count one by one? No? Ok, then, how about using a flow to automate the counting of cases? Yes? Great! Let me show you how. Follow my simple tutorial and enjoy!
Flow Scenario: Display All Cases on an Account Prioritized in High, Medium, and Low Order
Go here: Setup menu / Flows / New Flow
Choose this: Screen Flow
Before building the flow, create all the resources you’ll need.
RESOURCES YOU'LL NEED:
The first resource you'll need is a text type and is called "recordId;" it will hold the ID of the record your flow will be processing, so it needs to be marked as "available for input."
You'll also need variables to store the count for your low-priority cases, medium- and high-priority cases, each of which will be a number with the default of zero. No decimals. Name it "HighPriorityCaseCountVariable."
Repeat the same process to create MediumPriorityCaseCountVariable and LowPriorityCaseCountVariable. So, you'll have these many resources so far.
BUILD YOUR FLOW
You've created your resources, and now you're ready to build your flow. So, get your records first, and then you can work with them here. Click the plus sign and choose "get records."
You want to get all cases where account ID equals your recordId, which means the account where this flow is triggered will display its own cases. You want to store all records and all fields.
So, now you have all those cases, and you need to loop through them, which means each case needs to be examined. You loop through these records to get your counts for different priority cases. The collection to loop through was automatically created by Salesforce already from your "get records" step, so choose that auto-populated collection. Loop items in the first-to-last order. Here's the screenshot to guide you.
Here's what you should be looking at so far.
Now you need a decision element with multiple outcomes. What is the decision? You are checking the following: what is the priority of each case? You'll choose the record (case) where priority equals high. Here's how you'll do it step-by-step with screenshots.
领英推荐
This was outcome number one. To add outcomes, click the plus sign as demonstrated below on my screenshot. You'll repeat this for each outcome to have outcomes for each priority rating on the case object.
What if your case has no priority assigned? There's default outcome set in your flow for that already. At this point, you are looking at something like this: see my screenshot to guide you. Click plus under the default outcome and add "end."
Now, when a high-priority case is found among your records, you want to assign "1." So, you need an assignment. Click the plus sign under the high priority outcome and select "assignment." Name it "High Priority Count Assignment." Remember you created a High Priority Count Variable to hold your count number? Select it, then choose "add" and "1."
Repeat what you just did for each case priority rating.
Here's what you should be looking at now.
Now that all your records have been looked through, rated, and counted, it's time to display your counts. For that, you need to add the screen element after your loop. Here's how.
A screen element has a header and a footer. Label it "Results Screen." There's a checkbox to uncheck in order to hide your header. Let's do that because we don't want to display it. And next you want to find the "Display Text" component on the left, then add to the top of your screen instead of that hidden header. The API will be "Results_Text."
What do you want to display as text? Your results from all that tiresome counting of records! To display the count for high-priority cases you select the variable you created for it. To display the count for medium-priority cases you select the variable you created for it. To display the count for low-priority cases you select the variable you created for it. You can bold it all and save. Here's what you have created.
Save your flow. I called mine "Case Prioritize and Count." Name yours whatever you want. Activate it. Here's what your flow looks like (ready to be tested). To test it, we need a record ID for an account in your org that has a bunch of cases assigned to it. I go to my Service cloud, grab a record ID for an account, and head back to my flow to test it.
When you have the account ID, go to your flow, click "debug," insert your record ID, and run. Here's your result and congratulations, trailblazer! Happy flowing and thanks for following my tutorial.
Salesforce Developer | Administrator | CPQ Specialist | SALE$F|OWCE
1 年Very useful
BDS/Data Analyst??1X Salesforce Certified??CRM ?? Data Enthusiastic
1 年Very useful Anna Szabo, MBA ????????
Anna Szabo, MBA Thanks for Sharing! ??