0

HI all I have a doubt in a validation rule.According to my requirement if a user tries to change a picklist value from 'Ready to program' to 'Approved' he shouldn't be able to do so unless the four checboxes say C1,C2,C3,C4 are checked. Is it possible using and and condition to check if all the checboxes are true and only then the picklist should be changed? Is this the way

not( or(
   and(checkbox1,!checkbox2,!checkbox3),
   and(!checkbox1,checkbox2,!checkbox3),
   and(!checkbox1,!checkbox2,checkbox3),
   and(!checkbox1,!checkbox2,!checkbox3)

))

NB:I have to add one more checkbox in the formula, But if this happens how do I prevent the picklist value from saving.

2 Answers 2

0

Please try this. If any one of the 4 checkbox is unchecked (FALSE) and user tries to change the Picklist Field value from 'Ready to program' to 'Approved' the validation rule will fire.

AND(
    OR(
        checkbox1 = FALSE,
        checkbox2 = FALSE,
        checkbox3 = FALSE,
        checkbox4 = FALSE
    ),
    ISCHANGED(PicklistField),
    ISPICKVAL(PRIORVALUE(PicklistField) , "Ready to program"),
    ISPICKVAL(PicklistField , "Approved")
)
5
  • Hi @Sneh There is a syntax issue in the OR ending bracket.According to my requirement the formula would be AND( OR( Confirmed_all_Required_Final_Attachments__c = FALSE, Confirmed_EIN_is_Correct__c = FALSE, Confirmed_Funding_Source_and_Accufund_Co__c = FALSE, Confirmed_Grant_Amount__c = FALSE, ), ISCHANGED(Stage__c), ISPICKVAL(PRIORVALUE(Stage__c) , "Ready to program"), ISPICKVAL(Stage__c , "Approved") ) A syntax issue remains
    – JK123
    Apr 27, 2022 at 5:18
  • Remove the comma after Confirmed_Grant_Amount__c = FALSE
    – Sneh
    Apr 27, 2022 at 5:24
  • Thanks @Sneh.It worked Consider the picklist has null value or any other picklist value right now and if it is changed to approved then also if the error should pop up.So I have to provide all these values in the picklist except the Approved value and also the null value in the priorvalues condition?
    – JK123
    Apr 27, 2022 at 5:50
  • If you want it to work for all prior picklist values including null then remove the condition to check the prior value.
    – Sneh
    Apr 27, 2022 at 5:56
  • Thanks it worked.
    – JK123
    Apr 27, 2022 at 6:09
0

Try with below formula will work for all whatever the value in the stage__c field and you try to change to Approved then validation rule will fire.

AND( OR( Confirmed_all_Required_Final_Attachments__c = FALSE, 

Confirmed_EIN_is_Correct__c = FALSE, Confirmed_Funding_Source_and_Accufund_Co__c = FALSE, Confirmed_Grant_Amount__c = FALSE ), ISCHANGED(Stage__c),ISPICKVAL(Stage__c , "Approved") )

You must log in to answer this question.

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