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
msglsmomsglsmo 

Case Validation Rule Help

Hi All,

I'm having a tough time composing a validation rule.

We have three custom fields on our case page that restricts an order from going through if an account has certain requirements - Credit Card Only, Purchase Order Only, Cannot Order Supplies.  These fields are formula fields and pulled from the account page:  

Account_Requires_CC__c    (TRUE/FALSE)
Account_Requires_PO__c    (TRUE/FALSE)         
Account_Requires_No_Supplies__c    (TRUE/FALSE)

In some cases, Account_Requires_CC__c and Account_Requires_PO__c could both be true, because the account requires either a PO or a CC to be used on order.

I wrote this rule, but I am recieving errors that it isn't valid:

IF(
(AND(Account_Requires_PO__c = "TRUE"), (Account_Requires_CC__c = "TRUE"),
ISPICKVAL ( Payment_Type__c  , "Open Account" )),
OR( PO__c = "",  CC__c ="")

In my mind, the rule says that if both Account_Requires_CC__c and Account_Requires_PO__c are TRUE and the pick value Payment_Type__c is "Open Account", and either the PO__c field or the CC_c fields are blank, then the forumula would be true and an error message would flag.

Is my logic incorrect?  Any thoughts?

 

Thanks!

 

Mike

CharlyGCharlyG

Your formula doesnt quite seem right. See my comments at the end of the lines.

 

IF(   //start the If

(AND(Account_Requires_PO__c = "TRUE"),(Account_Requires_CC__c = "TRUE"))   //both of these statements

,
ISPICKVAL ( Payment_Type__c  , "Open Account" )  //do this

,

OR( PO__c = "",  CC__c ="")  //otherwise do this

 

for a Boolean statement you do not have to say "equals TRUE", the field alone implies it is true. But you need to check for "equals FALSE", and not "equals Blank".

 

If you want to validate that either one of the 3 fields are true, you can use:

 

And(

ISPICKVAL ( Payment_Type__c  , "Open Account" ), 

OR(

Account_Requires_PO__c,

Account_Requires_CC__c,

Account_Requires_No_Supplies__c )

)

 

I hope this helps.