Collection Sort – Flow – Summer ’21

Salesforce has now added an amazing feature to a flow’s logic elements – Collection Sort. This gives us the ability to sort a collection variable in ascending or descending order.

Since I am posting this even before the release notes are out, it definitely looks exciting because the sorting works for Record collection variables, Apex-defined collection variables and pretty much every primitive data type collection a flow allows.

Record Collection Variable (Contact)

Apex-Defined Collection Variable

In case you are looking for the class I used for my apex-defined variable type.

public with sharing class ApexObject {
    public String someString;  

    public List<String> stringCollection;

Stay hooked for more updates! 🙂

Leave a Reply