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
Mark Graham 3Mark Graham 3 

Help with opportunity stage validation rule please

I need help with creating a validation rule around the opportunity stage please.  We have 4 stages in our org
  • Opportunity
  • Opportunity - quoted
  • In for quarterly target
  • Won
At this moment, sales managers can select 'In for quarterly target'  without the 'Opportunity - quoted' stage being selected, they can skip the quote stage altogether. 

What I need to do is add a rule where the guy cannot jump to 'In for quarterly target' without the opportunity previously having being set as 'Quoted' and ideally have a check for a CPQ record also. 

I have the below, which partially works, although when I save the Opp record as 'Quoted' and then try to save it as in for target, it throws me the same errror. Somethings wrong.... any ideas whats wrong with the below?

AND(
ISCHANGED(StageName),
TEXT(PRIORVALUE(StageName)) <> 'Opportunity - quoted',
TEXT(StageName) = 'In for quarterly target'
)
Best Answer chosen by Mark Graham 3
Mark Graham 3Mark Graham 3
Got it working with this!

AND(
ISCHANGED(StageName), 
TEXT(StageName)='In for quarterly target',
TEXT(PRIORVALUE(StageName))<>'Opportunity – quoted'
)

All Answers

gaurav gupta 253gaurav gupta 253
AND(ISCHANGED(StageName), TEXT(StageName)<>'In for quarterly target', TEXT(PRIORVALUE(StageName))=='Opportunity - quoted'')
Mark Graham 3Mark Graham 3
Hi Gaurav,
Thanks for the reply...although that doesnt work, it doesnt throw an error when I try to go from Opportunity to In for target
Mark Graham 3Mark Graham 3
Got it working with this!

AND(
ISCHANGED(StageName), 
TEXT(StageName)='In for quarterly target',
TEXT(PRIORVALUE(StageName))<>'Opportunity – quoted'
)
This was selected as the best answer