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
ANUDEEP PYNAANUDEEP PYNA 

Validation rule on opportunity to move stage by stage in backwards

Hi All,

I have configured opportunity record should be moved stage by stage in order using below syntax. I have query that, can we back trace the record in descending order. For eg: Stage - 4 to Stage-3 and Stage-3 to Stage-2 etc.,

OR(
AND(ISPICKVAL(StageName, "Stage 1 - Identified Opportunity"), NOT(ISPICKVAL( PRIORVALUE(StageName) , "Stage 0 - Prospect"))),
AND(ISPICKVAL(StageName, "Stage 2 - Response"), NOT(ISPICKVAL( PRIORVALUE(StageName) , "Stage 1 - Identified Opportunity"))),
AND(ISPICKVAL(StageName, "Stage 3 – Selection"), NOT(ISPICKVAL( PRIORVALUE(StageName) , "Stage 2 - Response"))),
AND(ISPICKVAL(StageName, "Stage 4 – Negotiation"), NOT(ISPICKVAL( PRIORVALUE(StageName) , "Stage 3 – Selection")))
Maverick BlazeMaverick Blaze
I have configured the opportunity record to move from one stage to another in a specific order using the syntax you provided. However, you're wondering if it's possible to trace the record back in descending order, for example, from Stage 4 to Stage 3, Stage 3 to Stage 2, and so on.
To achieve this reverse tracing, you would need to modify the existing logic and create additional conditions. The modified syntax would look something like this:
OR( AND(ISPICKVAL(StageName, "Stage 1 - Identified Opportunity"), NOT(ISPICKVAL(PRIORVALUE(StageName), "Stage 0 - Prospect"))), AND(ISPICKVAL(StageName, "Stage 2 - Response"), NOT(ISPICKVAL(PRIORVALUE(StageName), "Stage 1 - Identified Opportunity"))), AND(ISPICKVAL(StageName, "Stage 3 - Selection"), NOT(ISPICKVAL(PRIORVALUE(StageName), "Stage 2 - Response"))), AND(ISPICKVAL(StageName, "Stage 4 - Negotiation"), NOT(ISPICKVAL(PRIORVALUE(StageName), "Stage 3 - Selection"))),
 
AND(ISPICKVAL(StageName, "Stage 3 - Selection"), NOT(ISPICKVAL(PRIORVALUE(StageName), "Stage 4 - Negotiation"))),
AND(ISPICKVAL(StageName, "Stage 2 - Response"), NOT(ISPICKVAL(PRIORVALUE(StageName), "Stage 3 - Selection"))),
AND(ISPICKVAL(StageName, "Stage 1 - Identified Opportunity"), NOT(ISPICKVAL(PRIORVALUE(StageName), "Stage 2 - Response"))),
AND(ISPICKVAL(StageName, "Stage 0 - Prospect"), NOT(ISPICKVAL(PRIORVALUE(StageName), "Stage 1 - Identified Opportunity")))

This updated syntax adds conditions for tracing the record in reverse. It checks if the current stage is equal to a certain stage and the previous stage is not equal to the stage it should normally progress from.
Remember to consider any specific business requirements or constraints when implementing this logic.
I hope this solution adds value to your query. If you have any further questions, please let me know.
Regards: APKWA (https://apkwa.net/)