Loading
Salesforce Enforces New Security Requirements in Summer 2026Read More
Extend Salesforce with Clicks, Not Code
CONTAINS

CONTAINS

Compares two arguments of text and returns TRUE if the first argument contains the second argument. If not, returns FALSE.

Use

CONTAINS(text, compare_text) and replace text with the text that contains the value of compare_text.

Tips

  • This function is case-sensitive so be sure your compare_text value has the correct capitalization.
  • When using this function in a validation rule or workflow rule, fields that are blank are considered valid. For example, if you have a validation rule that tests to see if the serial number of an asset contains “A,” all assets that have a blank serial number are considered valid.
  • The CONTAINS function doesn't support multi-select picklists. Use INCLUDES to see if a multi-select picklist has a specific value.
Formula Example
Formula Example
IF(CONTAINS(Product_Type__c, "part"), "Parts", "Service")

This formula checks the content of a custom text field named Product_Type and returns Parts for any product with the word “part” in it. Otherwise, it returns Service. Note that the values are case-sensitive, so if a Product_Type field contains the text “Part” or “PART,” this formula returns Services.

 
Loading
Salesforce Help | Article