I have a Field called Form_Type__c which different form numbers like 460,461,465...

If the Form_Type__c has either values of 461/465 and if the Status__c = "Approved" Then There should be an Error saying Fill the ACSD Field Value is Required

but my code accepts all the values and saying ASCD Required

Here is the Validation Formula

OR(Form_Type__c = "461" || Form_Type__c = "465",AND(ISPICKVAL( Status__c , "Approved")))


Your current formula is returning true (throwing the error) if one or more of the following is true: Form_Type__c = 461, Form_Type__c = 465, Status__c = Approved.

The OR operator returns true if either of its two conditions are met. In your case, since you have a nested OR, if either Form_Type__c = "461" or Form_Type__c = "465" is true, then the first outer OR condition is met, returning true; additionally, if the second condition of the nested OR ISPICKVAL( Status__c , "Approved") is true, your OR operator also returns true. As a side note...currently, your AND operator is doing nothing, as you have only one condition inside of it.

Either of these will work, depending on your preferred syntax:

(Form_Type__c = "461" || Form_Type__c = "465") && ISPICKVAL( Status__c , "Approved")

or alternatively,

AND( OR(Form_Type__c = "461", Form_Type__c = "465"), ISPICKVAL( Status__c , "Approved"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.