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
Gleb VrevskyGleb Vrevsky 

Process Builder - time-dependent action will still fire if conditions are not met ?

Hello!

I have a Process which starts only when a record is created. Example of process: http://www.screencast.com/t/5okrck1Or
Time-dependent action is configured, which is sending out an email before object overdue date. Everything works fine, except of: scheduled action is executed in spite of conditions are met or not. E.g. criteria for Executing Actions is set to Object Status Equal to "Not Paid". If object status is changed to e.g. "Paid" before scheduled actions, it is still sending out an email. 

Process configuration seems to be fine...or should I start the process when a record is created or edited + "Do you want to execute the actions only when specified changes are made to the record?" set to YES ? 

From documentation:
"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."

Thanks a lot in advance.
Best Answer chosen by Gleb Vrevsky
James LoghryJames Loghry
Yes, you will need to use the "created or edited" condition if you want your time based workflow to be "deleted" if the conditions are no longer met.  By setting the condition to created only, then the rule is ONLY evaluated at that time and will execute regardless of any future changes.

All Answers

James LoghryJames Loghry
Yes, you will need to use the "created or edited" condition if you want your time based workflow to be "deleted" if the conditions are no longer met.  By setting the condition to created only, then the rule is ONLY evaluated at that time and will execute regardless of any future changes.
This was selected as the best answer
Gleb VrevskyGleb Vrevsky
@James, thank you for your answer. But, isn't it in conflict with this documentation ->  https://help.salesforce.com/apex/HTViewHelpDoc?id=workflow_time_action_considerations.htm&language=en ?

"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."
Brett WisseBrett Wisse

I agree with Gleb. I set up time dependent actions to fire, even using the "created or edited" condition and "only execute actions when specified changes are made". My scheduled tasks are still firing even when the criteria are no longer met. 
Luke OatesLuke Oates
We're having the same problem with time lapse actions.
The criteria are set to "when created or edited". At the time of creation the criteria are met, but if the record is edited to no longer meet the criteria before the time lapse action is due the action still triggers (i.e. its added to the queue when the record is created and not removed after its edited).
Has anyone come across a solution to this? is it a known problem?
Brett WisseBrett Wisse
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000fz6b
Brett WisseBrett Wisse
It's a versioning limitation. If you updated the process, it doesn't recognize changes in criteria.
Luke OatesLuke Oates
Hi Brett, Thanks for such a quick reply.

As a solution to our original problem in the first version (criteria not re-evaluating on edit), we created a second version of the process without the time lapse actions (as a stop gap whilst we tried to work out the issue), that is when we discovered the versioning problem that you have described in the linked discussion. The discussion that you've linked me to explains why our stop gap solution did not prevent external partners from incorrectly receiving email alerts (thanks again), but it doesn't actually explain or solve the original problem (in the case of there being only one process version the criteria not being re-evaluated before actions are executed).

If you or anyone else has thoughts on this I'd really like to hear them.
Tiffany MeileyTiffany Meiley
I recently had this situation in our org as well. The way I worked around it is I created an invocable process and broke my original process into two processes. Now if the status of the opportunity changes after the record met the criteria the record will have to go through the criteria of the invocable process before the time based action takes place. 
Michelle BilodeauMichelle Bilodeau
Tiffany,

I am also running into a similar issue regarding time-based actions in process builder. Would you mind sharing the structure of your work around using the invocable process? 

Thank you!
Michelle
Tiffany MeileyTiffany Meiley
@Michelle Bllodeau
Sure. My first process builder has an immediate action and a scheduled action and my invocable PB has just an immediate action. When a record is created or edited to meet the criteria of the intitial PB then the immediate action will occur right away and then the record (in this case opportunity) is put in a queue waiting for the scheduled action to occur which is record is sent through the invocable PB. To stop from having records that changed while waiting in the queue from acting on the scheduled action with out analyzing the requirements first. In this case I do not want opportunities with the stage of closed won/closed lost/cancelled to have a chatter message. Therefore, I changed my scheduled action to be an action that invokes another process builder. I created a second PB that is an invocable process and added the same conditions for the invocable process as the conditions that are on the initial PB contains. Finally, I made the actual action that I wanted to be time based on the original PB as the immediate action of the invocable process. This allowed each record that was put in the queue by the first PB to be reanalyzed before the second action actually occurrs.
Michelle BilodeauMichelle Bilodeau
@Tiffany Meiley
Awesome! Thank you for the sharing, this will definitely be useful for some of our current/future projects!
Tiffany MeileyTiffany Meiley
@Michelle Bllodeau
My pleasure. :)
Cornelia Winn 3Cornelia Winn 3
The way I got around this limitation is by keeping my email alerts in workflows and everything else in process builder because you can add evaluation criteria on the time dependent actions if they're field updates. Then I trigger my email alerts off of these evaluated field updates. 
Cameron Young 7Cameron Young 7
My work-around was using Process Builder to update a checkbox to true.  Upon checking the box, it would trigger a flow with all the updates.   The flow has criteria in it as well that would then allow me to control the updates at the time of trigger rather than constantly running even if the criteria changed.    The flow would also set the checkbox (that was originally updated to true by the process builder) to false to then allow the process builder to repeat again and again.  Hope that helps. 
Val RochaVal Rocha
It is 2022 and this is still a problem. After trying the workarounds sugested here, and doing some research, it was not easy but I found an important information, to solve my case: Time-dependent actions won't react when the criteria "isnull" is part of the conditions. "Salesforce ignores time triggers that reference null fields." About this: Relevant article here (https://help.salesforce.com/s/articleView?id=sf.workflow_time_action_considerations.htm&type=5)
What I did then was use different criteria to solve, and it seems to be working so far.