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
TriggerTrigger 

How do I write the below validation rule?

I am trying to create a validation rule containing 2 picklists, 1 Multi-picklist and 1 text area field.

Fields
Picklists - "Owner_Role__c"
Multi-Picklist - "Benefits__c"
Text Area - "Comments__c"

The syntax I have is as follows

> AND(OR(ISPICKVAL( Owner_Role__c , "CSA"),ISPICKVAL( Owner_Role__c , "CSM")) &&  Comments__c = "" &&  ISBLANK( Benefits__c ))

I am not getting any syntax errors but it is not working. It is like it is ignoring the last argument. Even when I change fields to test it does nt recognize the last argument.

The rule should check to see if the owner role value is "CSM" or "CSA" and if it is, then the Benefits and comments fields should be required.

Any help appreciated.
Thank you.
Best Answer chosen by Trigger
Romeo Ngo 1Romeo Ngo 1
try this.  You want both Comments and Benefits to be required.  when you fill in some text for comments, then the validation is no long valid because your comments__c != "" anymore.  So you want to use the "OR" statement to check if either of the Comment or Benefits is blank.
AND(
	OR(ISPICKVAL( Owner_Role__c , "CSA"),ISPICKVAL( Owner_Role__c , "CSM")),
	OR (ISBLANK(Comments__c), ISBLANK( Benefits__c ))
	)