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
A guestA guest 

Validation for Opportunity stage

Hi ,

 if anyone knows of a way to create a validation rule to ensure that an opportunity must pass through all of the stages before it can reach Closed Won? user should not skip to final stage without completing previous stages.one should pass through all the stages
eg. stages like suspect,proposal , negotiation then closed won. 
He should not jump from suspect to closed won directly he has to move from suspect then proposal later negotiation finally closedwon
I am new to salesforce anyone help me to achieve this with example.
Thanks.
Best Answer chosen by A guest
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Please use below VR:
 
ABS(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,0) 
- 
CASE(PRIORVALUE(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, 0) 
* 
CASE(StageName, 
"Closed Lost",0, 
1) 
)>1


Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi,

I trust you are doing very well.

You can use below Validation Rule.
 
ABS(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",9,0) 
-
CASE(PRIORVALUE(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",9,0))>1

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas
A guestA guest
Thanks khan,
helped me to solve
A guestA guest
But it should be able to select closed lost from any stage, how can i add this feature.
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Please use below VR:
 
ABS(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,0) 
- 
CASE(PRIORVALUE(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, 0) 
* 
CASE(StageName, 
"Closed Lost",0, 
1) 
)>1


Regards,
Khan Anas
This was selected as the best answer
Sagar Kuckreja 2Sagar Kuckreja 2
Hi,
I want to have validation rule which will not allow to skip the first 3 stage of Opportunity.
For example
I have 5 Stage
1)Prospecting
2)Qualification
3)Needs Analysis
4)Perception Analysis
5)Closed
If I directly try to chabge the stage from Open to Perception Analysis then it shoud show error that you cannot skip the stage.
Can anyone help me for this ?
Thanks.