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
Laura GilLaura Gil 

Complex validation rule is not working

Hi all,

I am trying to run a validation rule, but this is not even allowing me to set the required field and the message is only showing 'Snag it'.
Here the requirements first (object Case):
Case Subtype should be filled if Case Status is either ('On Hold' and substatuses 'On Hold X'/'On Hold Y'/'On Hold Z/On Hold W'
OR
Case Status ('Escalated'  and Substatuses 'Escalated A'/'Escalated B'/'Escalated C'/'Escalated D')
OR
Case Status ('Assigned' and Substatuses 'Assigned-Support'/'Assigned-Production')
OR Case Status ('Closed' and Substatuses 'Closed A'/'Closed B')

The Case Substatus field is based on a picklist value set of the same name.

Here my validation rule:
 
AND(
ISBLANK(TEXT(CaseType__c)),  
OR(
OR(AND(ISPICKVAL(Status, 'On Hold'), ISPICKVAL(SubStatus__c, 'On Hold - X')),
AND(ISPICKVAL(Status, 'On Hold'), ISPICKVAL(SubStatus__c, 'On Hold - Y')),
AND(ISPICKVAL(Status, 'On Hold'), ISPICKVAL(SubStatus__c, 'On Hold - Z')),
AND(ISPICKVAL(Status, 'On Hold'), ISPICKVAL(SubStatus__c, 'On Hold - W'))
),
OR(AND(ISPICKVAL(Status, 'Escalated'), ISPICKVAL(SubStatus__c, 'On Hold - A')),
AND(ISPICKVAL(Status, 'Escalated'), ISPICKVAL(SubStatus__c, 'On Hold - B')),
AND(ISPICKVAL(Status, 'Escalated'), ISPICKVAL(SubStatus__c, 'On Hold - C')),
AND(ISPICKVAL(Status, 'Escalated'), ISPICKVAL(SubStatus__c, 'On Hold - D'))
),
OR(AND(ISPICKVAL(Status, 'Closed'), ISPICKVAL(SubStatus__c, 'Closed - A')),
AND(ISPICKVAL(Status, 'Closed'), ISPICKVAL(SubStatus__c, 'Closed - B'))
),
OR(AND(ISPICKVAL(Status, 'Assigned'),
ISPICKVAL(SubStatus__c, 'Assigned - Production')),
AND(ISPICKVAL(Status, 'Assigned'),
ISPICKVAL(SubStatus__c, 'Assigned - Support')))
)
)
)

 
Maharajan CMaharajan C
Hi Laura,

Am seeing one extra close bracket at the end of formula. Please remove that one. 

Also you have written Case Status ('Escalated'  and Substatuses are 'Escalated A'/'Escalated B'/'Escalated C'/'Escalated D') but in formula you are using the substatuses as On Hold - A, On Hold - B... Check any spelling or special character you have include unusually in validation rule.

First check your validation rule with small piece if it is working fine add more logic then do the same.

Thanks,
Maharajan.C