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
Swetha A 5Swetha A 5 

I need to write a validation rule on opportunity. when a record type is "record type 1" and user has selected stage as "closed won", then he can't update the stage value to its previous value

I need to write a validation rule on opportunity. when a record type is "record type 1" and user has selected stage as "closed won", then he can't update the stage value to its previous value. Please kindly help me as it is an urgent requirement. Thanks in advance
Best Answer chosen by Swetha A 5
Swetha A 5Swetha A 5
This is the Answer of the above question::

OR(

AND(
ISPICKVAL(StageName, "Negotiation/Review"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Proposal/Price Quote"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Perception Analysis"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Id. Decision Makers"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Value Proposition"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Needs Analysis"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Qualification"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Prospecting"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won"))
)

All Answers

Patcs_1Patcs_1
Hi Swetha

Try this formula in Opportunity Validation rule

AND(RecordTypeId ='01XXXXXXXXXXXX',ISPICKVAL(PRIORVALUE(StageName),'Closed Won'), ISCHANGED(StageName))

Hope this helps!

Thanks

P.S : If this solves your problem, Please mark this as solution by selecting it as best answer.


 
Swetha A 5Swetha A 5
Hello Patcs_1
It is working. But the issue is that it is working for previous and next value.My requirement is it cant go backward. but it can go forward. For example: A user selects "closed won" at the time of opportunity record creation. After he edits the stage to "Negotiation/Review", validation should trigger. And if he selects the stage as "closed lost", validation should not trigger and record need to be saved. if it possible then please share the answer. Thank you..
Swetha A 5Swetha A 5
This is the Answer of the above question::

OR(

AND(
ISPICKVAL(StageName, "Negotiation/Review"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Proposal/Price Quote"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Perception Analysis"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Id. Decision Makers"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Value Proposition"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Needs Analysis"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Qualification"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won")),
AND(
ISPICKVAL(StageName, "Prospecting"), ISPICKVAL(PRIORVALUE(StageName), "Closed Won"))
)
This was selected as the best answer