Parse a Multi-Select Value in Visual Flow [Unmanaged Package included]

In my post on using a Flow inside another Flow, I mentioned wanting to create a Flow that could be re-used for the problem of needing to parse a Multi-Select value.  So, here it is!

Unmanaged Package:

https://login.salesforce.com/packaging/installPackage.apexp?p0=04ti0000000YDzZ

Let’s talk about what is in this Unmanaged Package, so that you understand what you’re installing into your Org.  I want you to be able to easily reference this Flow for any use cases you might have.  So, that is why it is listed as Unmanaged and why I’ll have this detailed blog post on what is going on.

Flow Overview

parse-flow-image

ParseFlow.jpg

Let’s talk about what each of these Elements are doing.

Remove Brackets

The Remove Brackets Element is cleaning up the input String that we have.

Remove Brackets Formula.jpg

The Formula (sorry, it doesn’t want to stay formatted for me):

TRIM(
SUBSTITUTE(
SUBSTITUTE(
{!input_MultiSelectString},
“[“,””),
“]”,””),
) + “;”

Note: I am cleaning up the original Input variable.  After I clean the variable, I am assigning that new value (my Text Formula above) to the new Text Variable called Multi_Select_Value.

removebrackets

Add Left Value

What we want to do now, is grab the Left value in our String and add it into a Collection Variable.  This will be what you can Loop through to perform login on.

Grab Left Value Formula.jpg

The Formula:

(LEFT({!Multi_Select_Value},FIND(“;”,{!Multi_Select_Value})-1))

grableft

Remove Last Parsed Value

Now that we’ve successfully added the first value into our Collection, we want to remove that value and its semicolon from the String.  This will allow us to then see if we have remaining values or not in our next element.

removelastparsedvalue

The Formula:

TRIM((RIGHT({!Multi_Select_Value},LEN({!Multi_Select_Value})-FIND(“;”,{!Multi_Select_Value}))))

removeparsed

Remaining Values to be Parsed?

All we’re doing here is checking to see if the value of Multi_Select_Value is null or not.  If it is null, then we want to exit the Flow and send out our Output.  If it is not null, we want to continue along and keep parsing until we have a null value.

decisionofparse

3 thoughts on “Parse a Multi-Select Value in Visual Flow [Unmanaged Package included]

  1. Jon LaRosa August 16, 2017 / 3:54 pm

    This is really awesome, thank you for sharing and making it an unmanaged package!! Any idea if it’s possible to use line-breaks as the delimiter instead of semi-colons

    Liked by 1 person

    • David Litton September 6, 2017 / 3:48 pm

      Probably possible, but I’ve not given it a shot. You’d have to figure out what the line break looks like in the text for it to find that.

      Like

      • Jon LaRosa September 6, 2017 / 6:36 pm

        Thanks David, I was able to figure it out. Basically I left your sub-flow intact and replaced line breaks in my input variable with semi-colons. Finding the line breaks is a little bit of a hack, but it works. I used this post as my guide: http://www.jdope.com/blog/newline-carriage-return-in-flow/

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s