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
SherriASherriA 

Workflow/Formula not giving expected result

I'm going around in circles trying to find a way to do this, and thought I'd come to the community for some help.  

 

Here's what I'm trying to do:  We're trying to evaluate the success of our RFP's as a marketing tool and need to determine if an opportunity advances to the next stage after an RFP is submitted.  We have a custom object that we use to track our RFP's and I've got a field that reads the current probability of an opportunity and translates that to yes/no/pending.  That part works fine.  The problem comes when we have an opportunity that is lost.  I can't seem to find a way to determine if the probability advanced before it was changed to 0 or not.  

 

So, I added a hidden field on the opportunity to try to capture this information but I can't seem to get it to work correctly.  I want to know the prior value of the probability field when someone changes it to Closed Lost / 0% probability.  What I did was create workflow with a field update like this:  

 

EVERY TIME A RECORD IS CREATED OR EDITED

CRITERIA:  PROBABILITY % NOT EQUAL TO 0

 

I don't want this to fire if they make edits after the deal is marked lost/probability = 0, because then the prior value would be 0, and that's what I'm trying to avoid.  What I hope this says is that the workflow should fire and update the field every time the opportunity is edited UNLESS the probability is already 0%.  

 

 

When the workflow fires, my custom field should update to the result of the following formula:  

 

IF(  Probability  = 0, PRIORVALUE(Probability), Probability)

 

 

What I'm trying to capture is that if the probability is changed 0, then my custom field will be updated with the prior value.  If the probability is not equal to 0 then my custom field will be updated with the current probability.  

 

However, when I try it out, all I get is 0 for a result, so obviously I've done something wrong.  Can anyone help?  

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Ahhhhh!  I think I may have found the problem...  Your WFR is firing "Every time the record is created or edited" (that's why it is continuing to fire if they make edits AFTER it is Closed/Lost.  

Unfortunately you can only use the PRIORVALUE Function in a WFR if it is set to " "Every time the record is created or edited" so we need to amend the WFR Formula to ignore records that are edited after they are closed.  I think we can get there by evaluating the IsClosed field and the PRIORVALUE(IsClosed) and saying something like "If the priorvalue of IsClosed was FALSE then that means this wasn't already Closed before, so fire the WFR...  er... sumthin like that.    

All Answers

Steve :-/Steve :-/

I do loves me a good WFR Challenge...

 

How about if you changed the trigger to ISCHANGED(IsClosed) ?  

Also, can you post your complete WFR and Field Update (screenshots of them your be great)

SherriASherriA

How does ISCHANGED (IsClosed) work?  I can't wrap my brain around when that would fire (its been a LONG week already!)  

 

Here's my WFR:  WFR

 

Here's the Field Update:  

FU

 

Thanks for trying to help me figure this out!  

Steve :-/Steve :-/

Okay, no guarantees, but lemme give this thing a shot.  

 

and "THANKS" for the screen shots of your WFR, you have no idea how much easier it makes this!  (are you listening out there fellow posters???)

SherriASherriA

Well, I'm almost there!  I tried using ISCHANGED(IsClosed) as the trigger like you suggested and that almost does what I want.  However, it doesn't fire when someone advances a deal from the RFP stage to the next one, so I'm still not capturing that critical piece of information.  Since the whole point is to determine if we advance or lose AFTER the RFP stage, I need to work that out.  The rest of the workflow is right...its just figuring out what to use to trigger it now.  

 

Thanks for your help so far.  If you have any more ideas, I'm all ears.  :)  

 

 

Steve :-/Steve :-/

Hey there, sorry for not getting back to you (tough week in the Salt Mines) your post kinda got me thinking about a VR that I wrote for someone a while back that prevented users from moving an Opportunity backwards.  I'm not sure if it will be any help for you but I thought i might post it anyway, just in case there are any bits and pieces that you could borrow for your Stage evaluation WFR.  

 

Anyway, here it is:

 

CASE( StageName ,
"Prospecting",1,
"Qualification",2,
"Needs Analysis",3,
"Value Proposition",4,
"Id. Decision Makers",5,
"Perception Analysis",6,
"Proposal/Price Quote",7,
"Negotiation/Review",8,
"Closed Won",9,
"Closed Lost",9,0)
<
CASE(PRIORVALUE(StageName) ,
"Prospecting",1,
"Qualification",2,
"Needs Analysis",3,
"Value Proposition",4,
"Id. Decision Makers",5,
"Perception Analysis",6,
"Proposal/Price Quote",7,
"Negotiation/Review",8,
"Closed Won",9,
"Closed Lost",9,0)

 

 

kyle.tkyle.t

I just played around with this in a Dev environment and have a feeling I know what the problem is.  What type is your field Probability for RFP?  I had set it up as a number and got zero, then changed to percent and it worked.

 

Also, my field update is literally just "Probability".  Since your workflow only fires when probability is not 0, you don't need the if condition in your field update since it will always evaluate to false if the workflow rule fires.

 

Try updating the field type to a percent rather than a number (you will have to delete your field update to do it).

Steve :-/Steve :-/

Hi Sherri,

 

Sorry I got pulled away on some things.  What I was thinking about when I posted my formula  

 

CASE( StageName ,
"Prospecting",1,
"Qualification",2,
"Needs Analysis",3,
"Value Proposition",4,
"Id. Decision Makers",5,
"Perception Analysis",6,
"Proposal/Price Quote",7,
"Negotiation/Review",8,
"Closed Won",9,
"Closed Lost",9,0)
<
CASE(PRIORVALUE(StageName) ,
"Prospecting",1,
"Qualification",2,
"Needs Analysis",3,
"Value Proposition",4,
"Id. Decision Makers",5,
"Perception Analysis",6,
"Proposal/Price Quote",7,
"Negotiation/Review",8,
"Closed Won",9,
"Closed Lost",9,0)

Is that we do something where we evaluate the current Opportunity Stage to the previous Opportunity Stage and return a number (either positive or negative).  So instead of a VR that prevents someone from selecting a lower Stage/Probability%  we use the "bones" of my VR Formula to capture the difference.  

 

 

Steve :-/Steve :-/

Ahhhhh!  I think I may have found the problem...  Your WFR is firing "Every time the record is created or edited" (that's why it is continuing to fire if they make edits AFTER it is Closed/Lost.  

Unfortunately you can only use the PRIORVALUE Function in a WFR if it is set to " "Every time the record is created or edited" so we need to amend the WFR Formula to ignore records that are edited after they are closed.  I think we can get there by evaluating the IsClosed field and the PRIORVALUE(IsClosed) and saying something like "If the priorvalue of IsClosed was FALSE then that means this wasn't already Closed before, so fire the WFR...  er... sumthin like that.    

This was selected as the best answer
SherriASherriA

Looks like that did it!  Thanks Steve!  

Steve :-/Steve :-/

and THAT boys and girls is why they pay me the BIG Bucks!    ;-)  

 http://www.youtube.com/watch?v=VtVFcJiqHSQ