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
SalesForce 13SalesForce 13 

Validation rule where only the administrator can select to move a value in the picklist

I have this validation rule in status, where it has 3 values (analysis, process, completed), all the profiles can assign these 3 statuses, but once it is in the completed value you must activate the rule where only the administrator can change that value 
I have it like this:

AND(
          ISPICKVAL(Status__c, "completed"), 
          RecordType.Name = "Sales", 
          NOT( ISNEW()), 
          $Profile.Name <> "System Administrator"
)

Could you help me?
Best Answer chosen by SalesForce 13
Andrew GAndrew G
Since we are testing that it cannot be changed from that value once set we need to look at the Prior Value, not the Value that it will become.
So try:
AND(
          ISPICKVAL(PRIORVALUE(Status__c), "completed"), 
          RecordType.Name = "Sales", 
          NOT( ISNEW()), 
          $Profile.Name <> "System Administrator"
)

HTH
Andrew
 

All Answers

Andrew GAndrew G
Since we are testing that it cannot be changed from that value once set we need to look at the Prior Value, not the Value that it will become.
So try:
AND(
          ISPICKVAL(PRIORVALUE(Status__c), "completed"), 
          RecordType.Name = "Sales", 
          NOT( ISNEW()), 
          $Profile.Name <> "System Administrator"
)

HTH
Andrew
 
This was selected as the best answer
SalesForce 13SalesForce 13
Thanks Andrew ,
 You're the best!