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
kmirakmira 

Help with Workflow rule - OPPTY PRIORVALUE & STAGE

HELP!
I need a workfloew rule that will Not send an alert to Sales Management when a deal is Closed Lost, and the prior stage value was either Identified or Dialog Initiated

Currently Sales Mgt gets email alerts everytime a deal is closed lost(that one was easy). I was told by some I have to do a custom rule by using Priorvalue but I can not get it right...
Can someone help!

SO far I have:
PRIORVALUE(Stage=Identified,Dialog Initiated)= TRUE
virago81virago81
Kmira,
I think this is what you're looking for.

OR(PRIORVALUE(Stage) = 'Identified',PRIORVALUE(Stage) = 'Dialog Initiated')
kmirakmira
Thanks virago81

Still can't get it- Please help. It says Extra (
or missing ) - nomatter which i put it



OR

(PRIORVALUE(Stage) = 'Identified')

(PRIORVALUE(Stage) = 'Dialog Initiated')

AND

(Opportunity: StageequalsClosed Lost)

AND

(Current User: RolecontainsVR)
kmirakmira
I guess the key is how to NOT (Block) send alert if Priorstage is
Identified',PRIORVALUE(Stage) = 'Dialog Initiated')

As I wrote I have this so far

OR

(PRIORVALUE(Stage) = 'Identified')

(PRIORVALUE(Stage) = 'Dialog Initiated')

AND

(Opportunity: StageequalsClosed Lost)

AND

(Current User: RolecontainsVR)
virago81virago81
Kmira,
The syntax is not that intuitive (it's like RPN), but this is the way to do it:
AND(OR(PRIORVALUE(Stage) = 'Identified',PRIORVALUE(Stage) = 'Dialog Initiated'),  Stage = 'Closed Lost', CONTAINS($UserRole.Name, 'VR'))
werewolfwerewolf
That won't work because:
  • The field is actually called StageName, not Stage
  • It's a picklist field
Try this instead:

Code:
AND ( 
OR (
PRIORVALUE( StageName ) = 'Identified', PRIORVALUE(StageName ) = 'Dialog Initiated'
)
,ISPICKVAL(StageName,'Closed Lost')
,CONTAINS($UserRole.Name, 'VR')
)

 

virago81virago81
Yes, werewolf.  Thank you for the clafication.  I was just trying to give the proper structure of the ANDs and ORs not really looking at the field names.
kmirakmira
To virago81 & werewolf,

After all that the syntax is fine but now it says:


Error: Function PRIORVALUE may not be used in this type of formula

Geeeeeezzzzzzzzz Why is that?

AND (
OR (
PRIORVALUE( StageName ) = 'Identified', PRIORVALUE(StageName ) = 'Dialog Initiated'
)
,ISPICKVAL(StageName,'Closed Lost')
,CONTAINS($UserRole.Name, 'VR')
)
werewolfwerewolf
Well, that would be because StageName is a picklist field, although oddly enough when I pasted that very formula into my formula editor it says "No Errors Found."

Maybe this will work for you?

Code:
AND (
OR (
ISPICKVAL(PRIORVALUE( StageName ) , 'Identified'), ISPICKVAL(PRIORVALUE(StageName ), 'Dialog Initiated')
)
,ISPICKVAL(StageName,'Closed Lost')
,CONTAINS($UserRole.Name, 'VR')
)

 

kmirakmira
Same error
Error: Function PRIORVALUE may not be used in this type of formula

Weird.

ASIDE: Also the key for me is that an alert NOT get sent when PriorValue is
Identified'or 'Dialog Initiated'

How does this block those two stages?

AND (
OR (
PRIORVALUE( StageName ) = 'Identified', PRIORVALUE(StageName ) = 'Dialog Initiated'
)
,ISPICKVAL(StageName,'Closed Lost')
,CONTAINS($UserRole.Name, 'VR')
)
werewolfwerewolf
Oh, I see.  I was testing the formula in a validation rule.  You're using it in a workflow rule.

So is this formula in the workflow criteria, or in the workflow field update?  It should be in the criteria...

As for the filtering out those stages, just put a NOT() around the OR().
kmirakmira
Werewolf,

Thanks for the tips...even though it is not together yet.

The workflow is for Evaluation Criteria

Currently it is a simple rule: (Opportunity: StageequalsClosed Lost) and (Current User: RolecontainsBH Eastern)

But now they (Management) do not want to be notified) if the rep has only initaited Diaolog or Identified. But all other Stages for Opps they want to know if it went to Closed lost if at any other stage.

Thanks again!
Kym
werewolfwerewolf
Per the docs on PRIORVALUE, you have to set your workflow rule to "Every Time A Record Is Created Or Edited" in order for PRIORVALUE to work.  Try that.
kmirakmira
werewolf,
 
IT WORKED!!! NO SYNTAX  ERROR! Yippy!   when I changed it to every time a record is created or edited.
YOUR THE BEST!
 
BUT NOW...when I put the (OR)  - to negate   'Identified'  'Dialog Initiated'  stages it says
"Error: Syntax error. Missing ')'
 
 
THis is what I put in (and o matter where I put another ")" it comes back with Syntax. Doesn't make sense since the (OR) is clsoed and open parenthe
 
 
AND (
(OR)
(
ISPICKVAL(PRIORVALUE( StageName ) , 'Identified'), ISPICKVAL(PRIORVALUE(StageName ), 'Dialog Initiated')
)
,ISPICKVAL(StageName,'Closed Lost')
,CONTAINS($UserRole.Name, 'VR')
)
kmirakmira
Or do you think I should just put in all the other stage value names and leave it in the positive, thus only those stages get the alert?  To meesy?
werewolfwerewolf
 
You're misunderstanding how these operators work.  You can't put OR in parens by itself, that's not going to work.  Remember that these are all prefix operators, like Excel has.  I know you're thinking like "1 OR 2 OR 3."  The way all these operators work are prefix like OR(1, 2, 3).  The same is true of NOT, except that it only takes one argument like NOT(x).  So:

Code:
AND (
NOT (
OR (
ISPICKVAL(PRIORVALUE( StageName ) , 'Identified'), ISPICKVAL(PRIORVALUE(StageName ), 'Dialog Initiated')
)
)
,ISPICKVAL(StageName,'Closed Lost')
,CONTAINS($UserRole.Name, 'VR')
)







kmirakmira
Thank you! This is perfect!