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
VashnarVashnar 

Checklist true, then do not allow picklist value

I'm trying create a validation rule that will not allow a picklist value to be chosen if the checkbox is checked.

 

This is as far as I've gotten...

 

AND(
PRIORVALUE(D2D_Account__c, "true")
ISPICKVAL(Type, "Archived")

 

Tried searching the board and couldn't find a solution.

 

Thanks in advance!

Brian

Best Answer chosen by Admin (Salesforce Developers) 
Shannon HaleShannon Hale

If I understand correctly, you shouldn't need to check for the prior value of the checkbox. You only care that the checkbox is checked when you try to save the record.

 

Try this:

 

AND( /* Only return true if both of the following are true */
  D2D_Account__c,                 /* If the checkbox is checked, this is true */
  ISPICKVAL( Type, "Archived" )   /* If "Archived" is selected, this is true */
)

 This prevents the record from being saved if the checkbox is checked and "Archived" is chosen in the picklist.

All Answers

Shannon HaleShannon Hale

If I understand correctly, you shouldn't need to check for the prior value of the checkbox. You only care that the checkbox is checked when you try to save the record.

 

Try this:

 

AND( /* Only return true if both of the following are true */
  D2D_Account__c,                 /* If the checkbox is checked, this is true */
  ISPICKVAL( Type, "Archived" )   /* If "Archived" is selected, this is true */
)

 This prevents the record from being saved if the checkbox is checked and "Archived" is chosen in the picklist.

This was selected as the best answer
VashnarVashnar

Worked perfectly - Thanks!