function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chris ValkoChris Valko 

CONTAINS Function AND/OR In Same Statement

I am attempting to use the following but it does not seem the AND is being looking at separately after the OR.  For example, I am still getting a TRUE result for records with "DRIVE" in the shipping address:
 
((CONTAINS(Ship_To_Address_1__c,"cruise ") || CONTAINS(Ship_To_Address_1__c,"INTERCRUISES") || CONTAINS(Ship_To_Address_1__c,"CRUISE ")) && ((NOT(CONTAINS(Ship_To_Address_1__c,"ST") && (NOT(CONTAINS(Ship_To_Address_1__c,"DRIVE" )
I even tried using the OR( AND( tags.
 
Best Answer chosen by Chris Valko
Akhil AnilAkhil Anil
Hi Chris,

Give this a shot !
 
AND(
OR(
CONTAINS(Ship_To_Address_1__c,"cruise"),
CONTAINS(Ship_To_Address_1__c,"INTERCRUISES"),
CONTAINS(Ship_To_Address_1__c,"CRUISE")
),
NOT(CONTAINS(Ship_To_Address_1__c,"ST")),
NOT(CONTAINS(Ship_To_Address_1__c,"DRIVE"))
)

 

All Answers

Akhil AnilAkhil Anil
Hi Chris,

Give this a shot !
 
AND(
OR(
CONTAINS(Ship_To_Address_1__c,"cruise"),
CONTAINS(Ship_To_Address_1__c,"INTERCRUISES"),
CONTAINS(Ship_To_Address_1__c,"CRUISE")
),
NOT(CONTAINS(Ship_To_Address_1__c,"ST")),
NOT(CONTAINS(Ship_To_Address_1__c,"DRIVE"))
)

 
This was selected as the best answer
Chris ValkoChris Valko
Thanks that worked.