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
Mohith SundarMohith Sundar 

Enforcing validation rule from new to closed

i have a custom picklist field having values below 
   New
  Inprogress
  Working
  Closed 

I want to enforce values must be selected in order users should not be able to select the values from new to working directly could anyone help me please 
Best Answer chosen by Mohith Sundar
Khan AnasKhan Anas (Salesforce Developers) 
Hi Mohith,

Use this:
CASE( Status__c , 
"New",1, 
"Inprogress",2, 
"Working",3,
"Closed",4,0) 
<> 
CASE( PRIORVALUE(Status__c) , 
"New",1, 
"Inprogress",2,
"Working",3, 
"Closed",4, 0) + 1

Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Mohith,

Greetings to you!

Please try below validation rule:
CASE( Status__c , 
"New",1, 
"Inprogress",2, 
"Working",3,
"Closed",4,0) 
> 
CASE( PRIORVALUE(Status__c) , 
"New",1, 
"Inprogress",2,
"Working",3, 
"Closed",4, 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. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Mohith SundarMohith Sundar
Hi Khan , 

Thanks thats works , however i dont want to  users to do reverse selection ex:from inprogress to new they should not be able to select 
Khan AnasKhan Anas (Salesforce Developers) 
Hi Mohith,

Use this:
CASE( Status__c , 
"New",1, 
"Inprogress",2, 
"Working",3,
"Closed",4,0) 
<> 
CASE( PRIORVALUE(Status__c) , 
"New",1, 
"Inprogress",2,
"Working",3, 
"Closed",4, 0) + 1

Regards,
Khan Anas
This was selected as the best answer
Mohith SundarMohith Sundar
Thanks and great too