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
ManuelForceManuelForce 

Dependent checkbox validation

Hi fellow "Force" users.

 

I have been trying to locate the solution to this issue for a few days now -

without success.

 

I would need a formula for a  validation rule to provide the following:

When a user wants to change the sales stage to a higher probability,

a new checkbox appears or is activated (easier to do than the former I think),

which needs to be a required field.

The new sales stage an only be saved if this required box is checked.

 

Any suggestions on such a formula(s)  (checkbox appears + checkbox is required +

error message when checkbox is not checked) 

would be highly appreciated.

 

(Making a checkbox required via page layout apparently is not possible)

 

Thanks a million in advance !

 

Manuel

 

 

MarkSilberMarkSilber

You are correct that a checkbox can't be made required in a page layout. If you have a need to make a true / false type entry required in a page layout, you have to make it a picklist and use "Yes" , "No" as values.

 

You also can't make a checkbox dependent on a picklist, but a checkbox can drive a picklist dependency.

The solution I came up with involves creating a formula field to produce a stage number. The validation rule then looks at this field and the previous stage number compared to the current stage number. If the stage number is higher and checkbox isn't checked, then it will fire the validation rule and prevent a save. I left Closed/Lost as a valid entry, but if you want to exclude Closed/Lost, just change the Case statement to set the stage number to 0 for Closed/Lost so it won't be included. You can also adjust the formula field if you only want to run validation for certain stage changes.

What's the end result for having the checkbox? Is a manager going to uncheck it after an Opportunity review? If not, you need to uncheck it before they move the stage to another value -- probably via a workflow or the validation rule won't run a 2nd time. You will also have to remember to maintain this formula field if you change Stages. It also could be more complex if you have more than 1 Sales Process (this assumes you only have 1).

 

Here's the Stage Number (StageNumber__c) formula field (type: Number, 0 decimal places):

CASE( StageName, "Prospecting", 1, "Qualification", 2, "Needs Analysis", 3, "Value Proposition", 4, "Id. Decision Makers", 5, "Perception Analysis", 6, "Proposal/Price Quote", 7, "Negotiation/Review",8, "Closed Won",9, "Closed Lost", 10,0)

 

Here's the validation rule (my checkbox field is named StageChangeCheckbox__c for this example:

AND(NOT( StageChangeCheckbox__c), StageNumber__c > PRIORVALUE(StageNumber__c))

 

Let me know if you have questions.

 


 

 

ManuelForceManuelForce

Mark, Thanks a bunch !

 

I have found a way, though, of doing what I want with 

multiple pick lists.

 

Thanks again.

 

Manuel

KimAnnCKimAnnC

What is the solution you found?

Steve :-/Steve :-/

Depending on which edition of SFDC you're using you could also create a Workflow Rule with a Field Update.

Steve :-/Steve :-/

@KimAnnC

What are you having trouble with?