0
votes

I am working on a validation rule on the Opportunity object. The goal is to bypass a validation rule if an item from a Multi-Select picklist is selected, otherwise the code should fire

Here's what I have so far - everything works except the exception portion - NOT(CONTAINS('Campaign_Tactic__c','Call Monitoring')))

So the validation rule should fire unless the Call Monitoring multi-select is chosen.

The Validation Rule should prevent an Opportunity Save if:

  • Opportunity Record Type = True
  • Opportunity Stage = Closed Won or Proposal Request
  • Landing Page Setup Field = blank/no data
  • Campaign Tactic Multi-Select field = does not contain the Call Monitoring Option

    AND (
        RecordType.DeveloperName = "New_Opportunity",
        OR ( 
            ISPICKVAL(StageName, "Closed Won"), 
            ISPICKVAL(StageName, "Proposal Request")
        ), 
        AND ( 
            ISBLANK(TEXT(Landing_Page_Setup__c))
        ),
        (!CONTAINS('Campaign_Tactic__c','Call Monitoring'))
    )
    
1

1 Answers

0
votes

From the Salesforce Formula Function Reference, it's important to note

The CONTAINS function does not support multi-select picklists. Use INCLUDES to see if a multi-select picklist has a specific value.

Additionally, the first argument you're providing to CONTAINS() is a quoted string literal, not a field reference, and the outer parentheses are extraneous:

    (!CONTAINS('Campaign_Tactic__c','Call Monitoring'))

Your final clause should use INCLUDES(), as:

!INCLUDES(Campaign_Tactic__c, 'Call Monitoring')

Note also that AND() with a single argument can be replaced by the argument alone, so

AND ( 
    ISBLANK(TEXT(Landing_Page_Setup__c))
),

reduces to

ISBLANK(TEXT(Landing_Page_Setup__c)),

You need the TEXT() call only if that field is a picklist.