+ Start a Discussion
Steve CairneySteve Cairney 

WFR Fires, but Time Based Action doesn't.

Hi, I have a WFR with the following rules with the evaluation criteria created and edit

(Opportunity: Stage EQUALS Closed Won) AND (Opportunity: Booked GREATER OR EQUAL 1) AND (Opportunity: Live Alert EQUALS False)

The immediate action is to Field Update and there is a time dependant action of an email alert set to fire 1 day before the value of a date field.

This is no longer working (it used to) so I fired up the debug logs and edited a record so that it was out of the criteria, then back in the criteria. What I noticed was the field update worked (normally how I tell if a WFR is working or not) but the time dependent action is not in the time-based-workflow monitor.

The last time this happened it was because of a change in the SF seaosn release but so far I can't crack this egg again using the same workaround.

Can anyone point me in the direction of working out why this has happened and why the field update would work but not the time based action. Hopefully I'll be able to make some progress fixing this.

User-added image

Best Answer chosen by Steve Cairney
Steve CairneySteve Cairney
OK, so I deactivated the WFR that set's the booked checkbox to true and edited the field manually. This fired the WFR.

So I guess now I need to delay the booked checkbox WFR. I'll add a time-dependant action to it and see how it goes. 

All Answers

Did you try checking Time-Based Workflows in the setup? You can see all the queued time based workflow if they are scheduled.

Setup | Monitor | Time-Based Workflows -- click Search without criteria
Steve CairneySteve Cairney
Yeah, it's not in there
Steve CairneySteve Cairney
The more I look at my WFRs, the more I'm discovering aren't completing in total. For example, I have a WFR that fires and does multiple things including changing the record type. But the changing of the record type isn't actioning when the other parts of the WFR are.

I'm wondering if these are all connected somehow.
Since you mentioned that you have a lot of WFRs running in the background, does your current record still meet the criteria in your first WFR? Reason why I ask is because:

Time-dependent actions remain in the workflow queue only as long as the workflow rule criteria are still valid. If a record no longer matches the rule criteria, Salesforce removes the time-dependent actions queued for that record.
For example, an opportunity workflow rule can specify:A criteria set to “Opportunity: Status not equals to Closed Won, Closed Lost”
An associated time-dependent action with a time trigger set to 7 days before the opportunity close date

If a record that matches the criteria is created on July 1 and the Close Date is set to July 30, the time-dependent action is scheduled for July 23. However, if the opportunity is set to “Closed Won” or “Closed Lost” before July 23, the time-dependent action is removed from the queue.

Steve CairneySteve Cairney
Sure, you raise a good point there. I've checked this out but it's not the case.

Here's the lowdown on the criteria.

There is a related object called Media Cost. When this related object is booked a formula field on the Opp tallies up how many have been booked.

As we know, a forumula field update won't trigger a WFR, so if the formula field is >= 1 another WFR on the Opp object will set a checkbox (is_booked__c) to TRUE.

This is the criteria to fire the WFR. This is the content

Live Alert
Rule Name Opp Live Date Object Opportunity
Evaluation Criteria Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria
Rule Criteria Is_booked__c = TRUE

Immediate actions:
Task:  Live Alert Email Sent to Planner (so I can see if it's working)
Field Update: Live alert (set to TRUE)

This is a checkbox. The idea behind this is if it's set to TRUE I can add that to the criteria so the email alert isn't sent more than once.

Time dependant actions. This is based on a Date feild called Campaign Live Date. (on my test record this is in the future)
Email Alert 1 Day before "Campaign Live Date".

Now here's the results from the test record. I edited it to not meet the criteria, then checked the booked field on the related object. As you can see the WFR to update the is_booked__c feild works.

User-added image

But the Live Alert WFR is evaluated but as FALSE. 

If you look at the debug logs for the Live WFR, you can see that it is_booked__c was evaluated as '0' when in fact it should be '1'.

User-added image

This is a real headscratcher since it DID work for a few weeks until Winter 2016 release.

I think we have encountered the same issue with my previous project before. We have 2 workflows. One of the workflows' criteria is dependent on the result of the first workflow.

The issue was the order of execution of the worfkflows. The second workflow evaluates first causing it to fail / not met the criteria because obviously the first worklfow hasn't performed it's process yet. You might want to check this kind of scenario. 
Steve CairneySteve Cairney
Hmm, according to the debug, booked check checked first, then the live alert rule runs. I'll look at this again on a new test record and I'll try to leave some time before everything.

Out of interest, did you overcome your problem, and if so how?
Steve CairneySteve Cairney
OK, so I deactivated the WFR that set's the booked checkbox to true and edited the field manually. This fired the WFR.

So I guess now I need to delay the booked checkbox WFR. I'll add a time-dependant action to it and see how it goes. 
This was selected as the best answer
That's good progress. What I did was the same thing with how you solve your issue. I would usually open the debug logs, do manual steps instead of the automated to compare the process, and if I have time dependent actions that will fire let's say 1 day after a specific date, i will usually decrease the waiting time to 0 hours to immediately see the result. 
Steve CairneySteve Cairney
That works now. The WFR that checks the booking checkbox is time delayed by 1 hr, the next WFR delayed by 2 hrs. Since the action will normally be 24hrs ahead, that's acceptable. Thanks for the help.