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
Evan MillaisEvan Millais 

Validation Rule for multiple fields in an an opportunity

Hi,

So I have 5 checkboxes that I want to be ticked if a user advances to certain stages - what formula do I need? More info below

Checkbox 1
Checkbox 2
Checkbox 3
Checkbox 4
Checkbox 5

If anyone advances to the below stages I want to make sure they can't if any of the above is unticked

Stage 1
Stage 2
Stage 3
Stage 4
Stage 5
Stage 6

Thanks :)

Best Answer chosen by Evan Millais
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Evan,

Can you try the below validation rule.
 
AND(OR( TEXT(StageName) = 'Qualification' ,TEXT(StageName) = 'Needs Analysis',TEXT(StageName) = 'Value Proposition',TEXT(StageName) = 'Perception Analysis',TEXT(StageName) = 'Proposal/Price Quote' ,TEXT(StageName) = 'Negotiation/Review' ), OR( !checkbox1__c , !checkbox2__c, !checkbox3__c, !checkbox4__c , !checkbox5__c ) )

Just replace the stages with your desired stages.

If this solution helps, Please mark it as best answer.

Thanks,
 

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Evan,

Can you try the below validation rule.
 
AND(OR( TEXT(StageName) = 'Qualification' ,TEXT(StageName) = 'Needs Analysis',TEXT(StageName) = 'Value Proposition',TEXT(StageName) = 'Perception Analysis',TEXT(StageName) = 'Proposal/Price Quote' ,TEXT(StageName) = 'Negotiation/Review' ), OR( !checkbox1__c , !checkbox2__c, !checkbox3__c, !checkbox4__c , !checkbox5__c ) )

Just replace the stages with your desired stages.

If this solution helps, Please mark it as best answer.

Thanks,
 
This was selected as the best answer
Maharajan CMaharajan C
HI Evan,

1. If your requirement is atleast any one checkbox need be checked on stage advance then try the below one:
 
AND( 
	OR (
		TEXT(Stage_Field__c) = 'Stage 1' ,
		TEXT(Stage_Field__c) = 'Stage 2',
		TEXT(Stage_Field__c) = 'Stage 3',
		TEXT(Stage_Field__c) = 'Stage 4',
		TEXT(Stage_Field__c) = 'Stage 5' ,
		TEXT(Stage_Field__c) = 'Stage 6' 
	), 
	OR(
		!checkbox1__c ,
		!checkbox2__c,
		!checkbox3__c, 
		!checkbox4__c , 
		!checkbox5__c 
	) 
)

2. If your requirement is particular checkbox needs be checked on particular stage advance then try the below one:
OR(
	AND(TEXT(Stage_Field__c) = 'Stage 2', !checkbox1__c)
	AND(TEXT(Stage_Field__c) = 'Stage 3', !checkbox2__c)
	AND(TEXT(Stage_Field__c) = 'Stage 4', !checkbox3__c)
	AND(TEXT(Stage_Field__c) = 'Stage 5', !checkbox4__c)
	AND(TEXT(Stage_Field__c) = 'Stage 6', !checkbox5__c)
)

Thanks,
Maharajan.C