Split String into List in Flow #inSalesforce

Split String into List in Flow #inSalesforce

Create a screen flow,


Create six variables:

occurrenceofCommaCollectionVariable: number type | Allow Multiple

stringVariable: text type | default - sample1,sample2,sample3

recordCollectionVariable: text type | allow multiple - True, final outcome to be stored here

splitVariable: text type (formula) | LEFT({!stringVariable},FIND(',',{!stringVariable})-1), get the first string

recordSubstituteVariable: text type(Formula), RIGHT({!stringVariable},LEN({!stringVariable})-FIND(',',{!stringVariable})), to remove the first string from the entire string

occurrenceofCommaVariable: number type(Formula), (LEN({!stringVariable})-LEN(SUBSTITUTE(LOWER({!stringVariable}),",","")))



Add assignment element:

occurrenceofCommaCollectionVariable Add 0

loop Through occurrenceofCommaCollectionVariable

Decision Element:

End of comma occurrence 

occurrenceofCommaVariable <= 0

If true,

Assignment ELement:

recordCollectionVariable Add stringVariable

If False,

Assignment Element:

recordCollectionVariable Add splitVariable

occurrenceofCommaCollectionVariable Add occurrenceofCommaVariable

stringVariable equals recordSubstituteVariable

Everything is stored in recordCollectionVariable

Get the contacts related to particular record id and name

get Element:

getContacts, object - COntact, Name In recordCollectionVariable and AccountId equals recordId

All Records

Screen Element with datatable to display the above returned

Create a Related Contacts button on Account and place in details page

As per the default value given in stringVariable, the records will be returned based on the get records criteria


Test it as in the video



















                                   Visual: https://www.youtube.com/watch?v=fKpwjvofCo8

Comments