Eliminate Manual Record Matching.

Eliminate Manual Record Matching | Automate This!


Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, Christina Nava uses a screen flow to match students and providers to save hours of manual work. In her screen flow, she uses the subflow twice — she builds and maintains it once but can re-use it multiple times, instead of building the same components twice in her flow.

Use case: The manual provider matching process takes too much time

At Gaggle, we provide therapy and coaching to students. The challenge lies in identifying the most suitable provider for each student based on various criteria such as session times, age, language, and specific issues. Previously, this manual matching process took up to 10 minutes for each new student, accumulating several hours of our staff’s time every week.

The solution: Automate the provider matching process with Flow

We decided to create a screen flow that would find all potential provider matches for a student and allow the user to select the best match.

One of the issues when creating this flow was the need to compare a multi-select picklist with another multi-select picklist. As I’m sure you’re aware, using a multi-select picklist comes with a warning label. One of the reasons Salesforce Admins hesitate to use them is because the output of the field value selection is a semicolon separated string which is difficult to work with in flows. However, multi-select picklists are easier for our students and providers when they need to select more than one option, so we need a way to work with these in our flow.

We have quite a few multi-select picklists we need to match between our providers and students, so instead of copying the same elements multiple times within my flow, I decided to create a subflow that I can call multiple times. The subflow receives a multi-select picklist and returns the selected values as a collection which is then used when attempting to find the list of potential providers for a student.

Part 1: Create a subflow

The first step in this solution is to create a subflow of type Autolaunched Flow (No Trigger) that accepts a text variable for input, processes it, and returns a text collection. Your final subflow should look like this:

Subflow that accepts a multi-select picklist and returns it as a text collection.

Create the following variables.

  • Input_MultiPicklist_Values: text variable that accepts the multi-select picklist you want to turn into a collection

Input_MultiPicklist_Values text variable that is available for input.

  • Selected_Values: text variable that contains the “current” string of the selected values from the picklist

Selected_Values text variable.

  • fx_Single_Value: formula that calculates the string of the FIRST value in Selected_Values
TRIM( LEFT({!Selected_Values} , FIND(";", {!Selected_Values})-1 ) )

fx_Single_Value Text Formula Variable with the following formula: TRIM( LEFT({!Selected_Values} , FIND(";", {!Selected_Values})-1 ) ).

  • fx_Updated_Selected_Values: formula that removes the first value from Selected_Values
TRIM( SUBSTITUTE( {!Selected_Values} , {!fx_Single_Value}+";" , "" ) )

fx_Updated_Selected_Values Text Formula Variable with the following formula: TRIM( SUBSTITUTE( {!Selected_Values} , {!fx_Single_Value}+";" , "" ) ).

  • Return_ValueCollection: text collection variable returned to the main flow that contains a collection of all the values the text field contains

Return_ValueCollection text collection variable that is available for output.

After you’ve created all the variables, it’s time to start building.

Add an Assignment element to do the initial copy of the multi-picklist values received from the main flow to the Selected_Values variable. You then need to Add a semicolon at the end in order to make the formulas work correctly.

Assignment element setting Selected_Values equal to Input_MultiPickllist_Values and adding a semicolon to the end.

Next, add a Decision element to check if Selected_Values is null (that is, there aren’t any values). If it is, we have either finished populating the Return_ValueCollection variable or the multi-select picklist is null (that is, didn’t have any values) when we called this subflow. In those cases, we end the subflow and the Return_ValueCollection variable is returned to the main flow. If Selected_Values is NOT null (that is, the variable contains values), then we continue with the subflow.

Decision element checking to see if Selected_Values is NULL.

Next, we use an Assignment element to Add the first value of Selected_Values (calculated using the fx_Single_Value formula) to Return_ValueCollection. Note, the operator for this assignment needs to be Add and not Equals. If you use Equals, Return_ValueCollection will be rewritten every time and you’ll end up returning just the last value from the multi-select picklist.

Assignment element Adding fx_Single_Value to Return_ValueCollection.

The last element of the subflow is another Assignment element. With this one, you’re resetting Selected_Values to remove the first string that you just added to Return_ValueCollection. This is accomplished by using the fx_Updated_Selected_Values formula.

Assignment element setting Selected_Values equal to fx_Updated_Selected_Values.

Finally, we’re going to reroute the connection from the last Assignment element back to the Decision element above. By doing this, you’re using the Decision element as a loop. You’ll continue to loop through the Decision and the two Assignment elements until the Selected_Values is null and the subflow ends. If you’d like more information on how the formulas are calculated, see the Formula Explanation section at the end of this blog post.

Once everything is created and tested, Activate the subflow so you can use it in the main flow you’re about to build.

Part 2: Create a screen flow

Now that you’ve created and activated the subflow, it’s time to create the Screen flow. Your final flow will look like this:

Completed screen flow.

Create the following variables.

  • recordId: text of the record ID of the Contact record from which the flow was called

recordId Text Variable that is available for input.

  • scol_EligibleProviders_FinalList: collection of Contact records

sCol_EligibleProviders_FinalList Record Collection variable.

After you create the variables, add a Get element to get the contact record of the student from which the flow was called. Then, add a Decision element to ensure the student is on the waitlist before moving on.

Get element to get the student's record.

Decision element checking to see if the student is on the waitlist.

We now need to retrieve the list of providers so we can start the matching (filtering). To do this, we need the record ID of the provider record type on the Contact object. Since we don’t want to hard code a record ID, we’re going to use a Get Records element on the Record Type object where SobjectType is Contact and the DeveloperName of the Provider Record Type.

Get Records element to retrieve the record type ID of the Contact provider record type.

Once we have the provider record type ID, we can add another Get Records element to get all active providers who have open availability. This gives us the first list of providers.

Get Records element retrieving all active providers that have open availability.

Now we want to filter out the providers who do not work with students of this student’s grade, who do not speak the same language as the student, and who don’t take clients in the student’s time zone. Each of these fields is a single picklist on the student’s record and a multi-select picklist on the providers. The easy way to filter our list is to see if the student’s selection is included in the provider’s multi-select picklist using the Contains operator in a Collection Filter element.

Collection Filter element filtering the available providers based on fields from the student record.

Next, we need to determine the providers who are specialized in helping the student with their specific issue(s). As each student may have been referred for multiple reasons and each provider can have multiple specialties, we need to compare a multi-select picklist to a multi-select picklist.

This is where the subflow you created earlier comes into play. We need to send the student’s reason for referral multi-select picklist to the subflow and receive a collection of values so we can loop through them. To do this, add a Subflow element to call the subflow you created above and include the student’s reason for referral.

Element calling the subflow we created above.

Now, we want to loop through the remaining providers, and within that loop, we want to loop through the student’s collection.

Element looping through each of the providers from Stage 1.

Element looping through each of the student's reasons for referral.

We’re comparing each of the student’s reasons for referral to each provider’s speciality areas.

Decision element checking to see if the current reason for referral for the student is included in the provider's specialties.

If a provider matches at least one referral reason, then they are added to the final list of providers.

Assignment element adding the current provider to the sCol_EligibleProviders_FinalList.

The next element is a Screen element that displays the student’s information and the final list of potential providers. The user can then choose the provider they want to assign to the student.

Screen element showing details about the student and displaying the list of potential providers.

We then check to see if the user selected a provider, by using a Decision element.

Decision element checking to see if the user selected a provider from the list.

Lastly, add an Assignment element to assign the provider, set the client status, and set a checkbox.

Assignment element updating the Provider, Client Status, and Assigned to Provider fields on the student's record.

Then, use an Update Records element to update the student record.

Update element writing the changes to the student's record to the database.

Note that each data manipulation language (DML) element (pink colored element) has a fault path to ensure the end user has a positive experience. The fault paths all terminate at the same Fault Screen to display the FaultMessage.

Screen element displaying the FaultMessage.

Before activating your flow, you want to test/debug it to make sure everything works correctly. Once completed, activate your flow.

Business results: Went from hours spent to minutes

The implementation of this solution has significantly reduced the time spent on manual matching. Our internal team, which previously spent up to 5 hours a week on these tasks, can now achieve the same results in just minutes.

Formula explanation

So how does the subflow take a semicolon separated string and turn it into a collection?

In my example below, I have a multi-select picklist with “one”, “two”, and “three” chosen by my user. The table shows the value of each variable during each of the loops through the Decision element.

Input_MultiPicklist_Values = “one;two;three”





Initiation / First Decision Loop





Second Decision Loop






Third Decision Loop







Final Decision



two three

Further explanation of how the formulas are calculated:

  • fx_Single_Value: TRIM( LEFT({!Selected_Values} , FIND(";", {!Selected_Values})-1 ) )
    • Let’s start from the inside out on this formula. The FIND function looks for a specified string within another string and returns the position of where that string starts. So, with this we’re finding the position of the first semicolon in the Selected_Values string. We are then subtracting 1 from that position so we can exclude the semicolon. In the next piece of the formula, we’re using LEFT to get the first value from Selected_Values. Last of all, we use TRIM to remove any spaces or tabs from the beginning or end of the string.
  • fx_Updated_Selected_Values: TRIM( SUBSTITUTE( {!Selected_Values} , {!fx_Single_Value}+";" , "" ) )
    • The first thing we do here is add a semicolon to the Single_Value string, then we look for that new string in the Selected_Values variable and replace it with null. This effectively removes that string and gives a new string with the first value removed.



Want to see more good stuff? Subscribe to our channel!

Use Flows and Experience Cloud to Access Salesforce Scheduler.

Use Flows and Experience Cloud to Access Salesforce Scheduler | Automate This!

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, learn how Lynn Guyer requests support from […]