An administrator is configuring a validation rule on the Case object to enforce data quality for enterprise support. The requirement states that when a Case with the Record Type 'Priority_Support' is set to a Status of 'Closed', the custom text field `Root_Cause_Code__c` must be populated and adhere to a specific 5-character format (two uppercase letters followed by three digits, e.g., 'RC101'). Additionally, the rule must only evaluate when the record is newly created or when the Status field is explicitly changed to 'Closed', avoiding false triggers on existing closed cases during mass updates. Which validation rule formula correctly enforces these conditions without failing due to improper null handling?
- AND( RecordType.DeveloperName = 'Priority_Support', ISPICKVAL(Status, 'Closed'), OR(ISNEW(), ISCHANGED(Status)), OR(ISBLANK(Root_Cause_Code__c), NOT(REGEX(Root_Cause_Code__c, '[A-Z]{2}[0-9]{3}'))) )Cevap
- BAND( RecordType.DeveloperName = 'Priority_Support', ISPICKVAL(Status, 'Closed'), NOT(REGEX(Root_Cause_Code__c, '[A-Z]{2}[0-9]{3}')) )
- CAND( RecordType.Name = 'Priority_Support', Status = 'Closed', OR(ISNEW(), ISCHANGED(Status)), REGEX(Root_Cause_Code__c, '[A-Z]{2}[0-9]{3}') )
- DAND( RecordType.DeveloperName = 'Priority_Support', ISPICKVAL(Status, 'Closed'), ISBLANK(Root_Cause_Code__c) )
Cevap
The validation rule formula using AND along with RecordType.DeveloperName, ISPICKVAL, ISNEW/ISCHANGED checks, and an OR condition checking ISBLANK alongside NOT(REGEX(...)) is the correct solution.
The correct formula evaluates the Record Type developer name, enforces picklist validation with ISPICKVAL, scopes evaluation to record creation or Status changes, and combines ISBLANK with NOT(REGEX(...)) so that any missing value or non-conforming text triggers the validation error.
Adım Adım Çözüm
Anahtar Kavram
Validation Rule Logic and Null Handling in Salesforce Formulas