Newsletter

The Answer for the Collection Filter & Collection Sort Challenge

Hello folks,

Last week I told you that I challenged myself to use as few elements as possible when searching for particular records among the cases in my Org. You can find the Collection Filter and Collection Sort post here.

I started with a get element that returns all the cases that have both account and contact assignments. I was able to extract the following information with only one get element:

  • Most Recently Modified Case
  • Oldest Modified Case
  • Oldest Modified Case Account Name
  • Number of Cases by this Account
  • Most Recently Closed Date for this Account
  • Contact Id on this Case
  • Number of Cases for this Contact
  • Oldest Closed Date for this Contact on this Case

It took me 21 elements, including one get, to find all these records. How did I achieve this? Check the image above for the details. Click on the image to see a bigger version.

Enjoy.

Andy Engin Utkan

P.S. If you like this newsletter, forward it to your friends. They can sign up for it here.

Enjoy.

P.S. Originally published on 06/07/2022.

Read the previous issue of the newsletter here.

Read the next issue of the newsletter here.

Subscribe to the weekly educational Salesforce Flow Tips newsletter here.

Standard
Newsletter

Collection Filter and Collection Sort Challenge

Hello folks,

How powerful are the collection sort and collection filter elements? How should you use them?

I experimented with collection filter and collection sort elements to see how far I can go using only one get element. In other words, I wanted my flow only to use up one SOQL against the governor limits.

I started with a get element that returns all the cases that have both account and contact assignments. I was able to extract the following information with only one get element:

  • Most Recently Modified Case
  • Oldest Modified Case
  • Oldest Modified Case Account Name
  • Number of Cases by this Account
  • Most Recently Closed Date for this Account
  • Contact Id on this Case
  • Number of Cases for this Contact
  • Oldest Closed Date for this Contact on this Case

Please see the image for the results.

How many elements did I use? Did I have to loop?

Here are the answers:

  • Your get element gives you sorting functionality. Use it.
  • You have to loop to get the min and max values, such as the oldest and most recent, sorted by Date and Time. But you need to loop only for one iteration. So you can exit after you assign the first record to a variable.
  • Your loop can use the existing sort or the reverse sort. Use this functionality.
  • Initially, I used a counter variable to exit the loop, but this was unnecessary. You need to exit the loop regardless after the first iteration. Insert a decision and connect both branches to the next element outside the loop.
  • You can get a count of records by using an assignment element with the operator “equals count”.

I experimented with the formula criteria inside the collection filter element without much luck. I think this functionality does not allow for filters with variable values on the right side of the equation. “ContactId on the current record = ContactIdVariable” formula did not work.

What do you think? Can these elements save you lengthy loops and executed elements?

How many elements, excluding the start or the end element, did I use to extract this information.

Join the discussion on LinkedIn here or Twitter here.

Live session recording links:

Watch Melody Lwo of Salesforce Flowsome and me either on LinkedIn here or YouTube here.

Enjoy.

P.S. Originally published on 05/30/2022.

Read the previous issue of the newsletter here.

Read the next issue of the newsletter here.

Subscribe to the weekly educational Salesforce Flow Tips newsletter here.

Standard
Newsletter

Collection Filter Element in Spring 22

Hello folks,

Let’s talk about the brand new collection filter element this week.

I wrote a newsletter issue about the get element before. Get elements are essential. They can query the Salesforce database and get multiple records for you. The corresponding functionality in coding is called SOQL. However, SOQL is much more powerful than the get element.

Get element and flow limitations can force the low-coder to build loops inside loops to process related records. When you are forced to build a solution like this, you should seriously consider whether flow is your best option.

When you loop within loops and start getting records, you run up against two limitations of flows:

  • You can only do up to 100 gets or SOQL’s in one synchronous transaction.
  • You can only process up to 2,000 elements in one flow interview.

This is where the new collection filter element comes to the rescue. For example, let’s say you need to get the cases for a specific contact under one account and show the case field values to the user. In the beginning, you can query all cases under the account. Then, you can show the user a few selection screens in your screen flow; finally, show the case field values and have the user edit them. Then, the user can go back to the contact selection screen and do it again for another contact. You can do all that using the new collection filter element without using another get element again after the first get execution.

Remember that your choice elements in your screen flows can accept collections as choices starting with Spring 22, as well.

But something even more impressive is offered with the new collection filter element. You can now use formulas to decide which records you select and add to your filtered collection.

You want to filter Account records with Annual-Revenue/Employee ratio within a specific range. Prior to this release, you had to create a formula field on the Object to show the Annual-Revenue/Employee calculation result. You don’t need to do that anymore. Instead, you can use a formula in your collection filter element to select records that have Annual-Revenue/Employee = $100,000, for example. This is huge.

If you don’t understand some of the concepts and the terms used in this newsletter issue, you may want to read get element issue here.

Recently published content:

My dear friend Daryl Moon and I had a live video chat o Flow Tips today on both LinkedIn and YouTube. Watch the YouTube recording here.

Enjoy

P.S. Originally published on 01/31/2022.

Read the previous issue of the newsletter here.

Read the next issue of the newsletter here.

Subscribe to the weekly educational Salesforce Flow Tips newsletter here.

Standard