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
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.
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.
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.
The Formula:
(LEFT({!Multi_Select_Value},FIND(“;”,{!Multi_Select_Value})-1))
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.
The Formula:
TRIM((RIGHT({!Multi_Select_Value},LEN({!Multi_Select_Value})-FIND(“;”,{!Multi_Select_Value}))))
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.
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
LikeLiked by 1 person
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.
LikeLike
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/
LikeLike