Checks whether a string or list includes a specified value in Salesforce Spiff. This function returns true or false.
Required Editions
| Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience |
| Available in: Enterprise, Unlimited, and Developer Editions |
| Available for an additional cost in: Professional Edition with Web Services API Enabled |
Syntax
contains(string_or_list, search_value)
Arguments
| Argument | Required? | Description |
|---|---|---|
| string_or_list | Required | The string, list of strings, or list of numbers that you're searching. |
| search_value | Required | The string or number you're searching for. Enclose string values in double quotes. |
Example
Turn a ClosedByRepInPeriod list into a list of items with the transform_list() function, and check whether the list includes the string "Widgets". To also check whether the function returns a value, enclose the function in an if() statement that returns 1 or 0.
=if(contains(transform_list(ClosedByRepInPeriod, Item__c), "Widgets") = true, 1, 0)
This formula can help make sure that payouts aren't made if the statement period includes the word "widgets".