-1

I'm trying to add validation rule.

Whenever change type is selected as "emergency", the fields selected should have some value and shouldn't be left blank. If any field is left blank, it should throw an error.

AND(
    ISPICKVAL(Change_Type__c, "Emergency"),
    (ISPICKVAL(Is_there_an_outage_in_progress__c, ""))
    (ISPICKVAL(Is_there_an_impact_to_Sales_Ordering__c, "")),
    (ISPICKVAL(Is_there_an_impact_to_our_Logistics__c, "")),
    (ISPICKVAL(Is_there_a_business_loss_or_potential__c, "")),
    (ISPICKVAL(Is_an_SMT_or_Incident_Ticket_opened__c, "")),
    (ISPICKVAL(Is_the_impact_to_internal_or_external__c, "")),
    (ISPICKVAL(Is_the_issue_impacting_one_site_or_many__c, "")),
    (ISPICKVAL(Is_there_communications_flowing__c, "")),
    (ISPICKVAL(Acceptable_to_schedule_to_next_CCB_mtg__c, ""))
    (ISBLANK( When_did_the_issue_start_exactly__c )),
    (ISBLANK( Is_this_due_to_a_recent_change_when__c )),
    (ISBLANK( How_many_users_are_impacted_Estimate__c )),
    (ISBLANK( If_a_business_loss_or_gain_how_much__c )),
    (ISBLANK( What_is_the_risk_of_the_change__c )),
    (ISBLANK( Is_the_issue_impacting_one_many_country__c )),
    (ISBLANK( Was_this_emergency_change_tested__c ))
)

I have given above condition but i am still able to save the records. any help on this much appreciated.

Thanks

2
  • 1
    Your checks for blank fields all need to be within an OR().
    – nfoley
    Jul 12, 2022 at 22:39
  • Thank you This worked
    – Harry
    Jul 13, 2022 at 4:42

1 Answer 1

1

This a boolean math problem. The validation rule is activated if the whole formula evaluates to '1' (true).

All the "ISBLANK" or "ISPICKVAL" functions should be inside an OR. Otherwise if one of those is blank -> '1' (false), even though the others are NOT blank, the whole formula evaluates to '0'.

AND(0,0,0,0,0,0,0,1) -> One field is blank, but the formula evaluates to 0. You don't get the error message.

OR(0,0,0,0,0,0,0,1) -> One field is blank, and the formula evaluates to 1. You get the error message.

When the formula evaluates to 1, you get the error you are needing!

I noticed that your formula lacks some commas. Please check!

1
  • 1
    Thanks for the detailed explanation, this worked :)
    – Harry
    Jul 13, 2022 at 4:43

Not the answer you're looking for? Browse other questions tagged .