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
KSTNEKSTNE 

Need some help with the IF THEN statement

Hi,

 

We are working on email templates and we cannot figure out how to do the IF THEN properly. Does Salesforce has an 'OR' operator ?

 

Basically what we have is 3 checkboxes, when one or more is checked we want the code to show "GOOD" when none are checked then show "BAD"

 

The code below is obviously wrong,

 

{!IF((Opportunity.fullcatalog__c==FALSE) OR (Opportunity.custommanudiv__c=FALSE) OR (pportunity.contactme__c=FALSE), "GOOD", "BAD")}

 

We also tried the "CASE" statement, but it did not work.

 

Thanks in advance!

Best Answer chosen by Admin (Salesforce Developers) 
gaisergaiser

> Does Salesforce has an 'OR' operator ?

 

Yes it does, but the syntax for 'OR' operator as opposed to OR() function is using double pipe: ||

 

{!IF(Opportunity.fullcatalog__c=FALSE || Opportunity.custommanudiv__c=FALSE || Opportunity.contactme__c=FALSE, "GOOD", "BAD")}

 alternative is using OR() function

{!IF(OR(Opportunity.fullcatalog__c=FALSE, Opportunity.custommanudiv__c=FALSE, Opportunity.contactme__c=FALSE), "GOOD", "BAD")}

 

All Answers

gaisergaiser

> Does Salesforce has an 'OR' operator ?

 

Yes it does, but the syntax for 'OR' operator as opposed to OR() function is using double pipe: ||

 

{!IF(Opportunity.fullcatalog__c=FALSE || Opportunity.custommanudiv__c=FALSE || Opportunity.contactme__c=FALSE, "GOOD", "BAD")}

 alternative is using OR() function

{!IF(OR(Opportunity.fullcatalog__c=FALSE, Opportunity.custommanudiv__c=FALSE, Opportunity.contactme__c=FALSE), "GOOD", "BAD")}

 

This was selected as the best answer
KSTNEKSTNE

The OR() function worked well, thank you!