The Text Collection Components package contains Salesforce sub-flows related to text collections.
- Split
- Text Collection Includes
- Text Collection To String
I developed these to support a custom Salesforce app for the John Muir Land Trust membership program. The NPSP Mebership solution did not meet the needs since it was based on tracking a single donation rather than tracking cumulative donations within a qualifying period (typically a calendar year).
The Split
subflow is used to convert a comma separated list of Opportunity Record Type names into a text collection. This list represents the record types that are in scope. For example, Donation, Gala, and Grant are in scope (among others). Orignially, I used the resultant collection to lookup the Opporunity Record Type Ids which were then used in the Get Records condition.
However, with improvements in the UnofficialSF's Excecute SOQL Action, I simplified the get-account-and-contact-oppportunities flow to use the Execute SOQL
action. With this I could use the SOQL WHERE...IN
clause to filter on the Record Type names. This required the names needed to be single quoted. Since I didn't want to burden the admin with doing this in the configuration record (a metadata object), I passed the output of the Split
into the Text Collection To String
with appropriate Bracket
and Quote
parameter values. In this way, a text template for building the SOQL could do something like this:
..." AND RecordType.Name IN (" & {!InScopeOpportunityRecordTypeNames} & ")"
Separates the input text into a collection of text values. The comma is the default separator. Optionally, a separator can be provided and it can a be text string such a semi-colon, one or more spaces, or a word, such as "and".
Inspired by the Java and Javascript split() method. Based on David Litton's "Parse Multi-Select" flow at https://salesforcesidekick.com/2016/11/07/parse-a-multi-select-value-in-visual-flow-unmanaged-package-included/.
Parameter | Type | Description |
---|---|---|
Text | Text | A delimted set of text values. |
Separator | Text | Optional. The character or text separating the values in the list. Extra spaces before or after the values will be trimmed (removed). The comma is the default separator. Optionally, a separator can be provided and it can a be text string such a semi-colon, one or more spaces, or a word, such as "and". |
Parameter | Type | Description |
---|---|---|
Values | Text Collection | A text collection (array) of the values in the input Text. |
Parameter | Type | Description |
---|---|---|
Collection | Text Collection | A collection (array) of text values. |
Value | Text | The value to look for in the collection of text strings. |
Parameter | Type | Description |
---|---|---|
IncludesValue | Boolean | True indicates that the value is a member of the collection; false indicates otherwise. |
Parameter | Type | Description |
---|---|---|
Collection | Text Collection | A text collection (array) |
Brakets | Text | An optional comma separated list of characters to use as the opening and closing characters. For example, "[,]" (without quotes) will enclose the output string in square brackets. It is possible to provided multiple character brackets (e.g., "begin,end"). Leading and trailing white space is trimmed from the provided values. |
Quote | Text | Set to a quote character, such as the single quote or double quote, to prepend and append to each item. Defaults to empty string. Useful for creating lists for a SOQL WHERE...IN clause. |
Parameter | Type | Description |
---|---|---|
String | Text | A string representation of the TextCollection. If default values are provided for Braket and Quote, String will be in the form of "[item1, item2, ...]". |
This is an unmanaged package.
Text Collection Components 1.2
Installation URL: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t4T000001ptbM
Installation URL path and search part: packaging/installPackage.apexp?p0=04t4T000001ptbM