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
H 007H 007 

validation rule for opportunity stage cannot select last value without selecting pervious one

Best Answer chosen by H 007
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Harsh,

Can you try the below validation rule.
 
AND(TEXT( Status__c ) ='Closed',Not(ISPICKVAL(PRIORVALUE(Status__c),"Completed")))

Let me know if you face any issues.
If this solution helps, Please mark it as best answer.

Thanks,
 

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Harsh,

The validation rule can be written but you need to check the previous stage and based on thay you need logic that the stage cannot be this. Can you let us know the stages in your org and in an order so i can provide you the rule.

Thanks,
 
H 007H 007
Hi Sai Praveen, 

I have a  "In Progress" , "inspection", "Cancelled", "Completed", "Closed". So I want a validation rule for my Status__c filed. If my status is Completed than only i am able to select Closed Status. 


Thanks,
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Harsh,

So you mean to tell that you just want validation only for that closed status right ?

Thanks,
 
H 007H 007
Hi Sai Praveen, 

Yes, you are right..

Thanks,
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Harsh,

Can you try the below validation rule.
 
AND(TEXT( Status__c ) ='Closed',Not(ISPICKVAL(PRIORVALUE(Status__c),"Completed")))

Let me know if you face any issues.
If this solution helps, Please mark it as best answer.

Thanks,
 
This was selected as the best answer
H 007H 007
Thanks Sai Praveen for your help.  Much appreciated!