CONTAINS in formula #inSalesforce

CONTAINS in formula #inSalesforce


This function compares 2 text strings and is commonly used in validation and workflow rules to search for a character or string in a text field. 


Used for:

1. Search for text.

2. Check if an unknown string or character matches a defined set of strings or characters.


Example 1:

CONTAINS(Description,"someSampleBadWord") - Returns TRUE if "someSampleBadWord" is found anywhere in Description.


Example 2:

Search for unknown string or characters.

CONTAINS("0123456789", theField__c) -This will return true for theField__c values such as 1,2,9,01,789, or any other substring of "0123456789"


Note:

This function considers BLANK value as true so include NOT(ISBLANK() along with CONTAINS to meet requirements. If using NOT on CONTAINS, it does not recognize BLANK values.



Reference: https://help.salesforce.com/s/articleView?id=000385300&type=1

Comments