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
kminevkminev 

ISChanged function on validation rule

Hi,

 

I need to apply a validation rule on my pick list where I need to check if the value on this particular picklist changed (ISCHANGED) then I need to see what was the prior value???

 

Is there a way I can get the original value of the picklist before it changed?

 

Thank you.

Best Answer chosen by Admin (Salesforce Developers) 
zen_njzen_nj

I have a similar situation where my requirement is that I don't want to prevent someone from changing a value, unless it's prior value was something and the new value they are changing it to is something else.

If you have similar requirement, you can use something like this:

 

In my example, I have a Case.Status field which has many possible values, one of them is "Completed" and one of them is "Begin Billing". And I will only allow specific users (i.e. those with a specific Profile) to be able to change Case Status from Completed to Begin Billing. So validation rule needs to check if prior Case Status=Completed and new Case Status=Begin Billing:

 

AND

(

$User.ProfileId <> 'xxxxxxxx',

ISCHANGED( Status ),
ISPICKVAL(PRIORVALUE( Status ), "Completed"),
ISPICKVAL( Status, "Begin Billing") 

)

All Answers

zen_njzen_nj

I have a similar situation where my requirement is that I don't want to prevent someone from changing a value, unless it's prior value was something and the new value they are changing it to is something else.

If you have similar requirement, you can use something like this:

 

In my example, I have a Case.Status field which has many possible values, one of them is "Completed" and one of them is "Begin Billing". And I will only allow specific users (i.e. those with a specific Profile) to be able to change Case Status from Completed to Begin Billing. So validation rule needs to check if prior Case Status=Completed and new Case Status=Begin Billing:

 

AND

(

$User.ProfileId <> 'xxxxxxxx',

ISCHANGED( Status ),
ISPICKVAL(PRIORVALUE( Status ), "Completed"),
ISPICKVAL( Status, "Begin Billing") 

)

This was selected as the best answer
kminevkminev
Thanks I got my ISPICKVALUE syntax wrong