Question

Difficulty: HardValidation Rules and Data Quality Enforcement

An administrator is configuring a validation rule on the custom object Asset_Service_Contract__c to enforce data quality standards. Business requirements state that whenever a contract status is set to 'Active', the custom field Renewal_Date__c must not be left blank, and the custom text field Compliance_Audit_Code__c must strictly follow a specific format starting with 'AUD-' followed by exactly three alphanumeric characters (such as 'AUD-101' or 'AUD-A12'). Which TWO validation rule formula syntax configurations will correctly enforce these data quality requirements? (Select 2 answers)

  1. AND( ISPICKVAL(Status__c, 'Active'), OR( ISBLANK(Renewal_Date__c), NOT(REGEX(Compliance_Audit_Code__c, 'AUD-[A-Za-z0-9]{3}')) ) )Answer
  2. AND( TEXT(Status__c) = 'Active', OR( ISBLANK(Renewal_Date__c), NOT(REGEX(Compliance_Audit_Code__c, 'AUD-[A-Za-z0-9]{3}')) ) )Answer
  3. C
    AND( ISPICKVAL(Status__c, 'Active'), ISBLANK(Renewal_Date__c), NOT(REGEX(Compliance_Audit_Code__c, 'AUD-[A-Za-z0-9]{3}')) )
  4. D
    OR( ISPICKVAL(Status__c, 'Active'), ISBLANK(Renewal_Date__c), REGEX(Compliance_Audit_Code__c, 'AUD-[A-Za-z0-9]{3}') )
  5. E
    AND( ISPICKVAL(Status__c, 'Active'), ISBLANK(TEXT(Renewal_Date__c)), REGEX(Compliance_Audit_Code__c, 'AUD-[A-Za-z0-9]{3}') )

Answer

The two correct validation rule formulas evaluate the status picklist using either ISPICKVAL or TEXT conversion, combined with an OR block containing ISBLANK for the date field and a negated REGEX function for format enforcement.
The correct validation rules evaluate whether the contract status is set to Active using either ISPICKVAL or TEXT status evaluation, combined with an inner OR block that checks if the renewal date is missing or if the compliance audit code fails the regular expression format test. Because validation rules block saving when the formula evaluates to TRUE, negating the REGEX match ensures incorrectly formatted codes trigger the error.

Step-by-Step Solution

1
Identify the criteria for triggering a validation error in Salesforce.
Validation rule formulas display an error message when the expression evaluates to TRUE.
The rule must evaluate to TRUE when the contract is Active AND either the Renewal_Date__c is missing OR the Compliance_Audit_Code__c does not follow the required pattern.
2
Evaluate picklist testing methods.
Both ISPICKVAL(Status__c, 'Active') and TEXT(Status__c) = 'Active' are valid methods for inspecting picklist fields in formula fields.
Standard text equality operators require converting picklist values using the TEXT function.
3
Construct the logical conditions for invalid data entry.
Use OR( ISBLANK(Renewal_Date__c), NOT(REGEX(Compliance_Audit_Code__c, 'AUD-[A-Za-z0-9]{3}')) ).
An error should occur if either data quality requirement is violated independently.

Key Concept

Validation rule formulas return TRUE to block record saving, requiring logical OR constructs to enforce multiple independent data completeness and pattern conditions.
Estimated Time:2m 0s
Rate this question