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
WhyserWhyser 

Workflow Rule Criteria reevaluation on lookup related fields for Time-dependent Actions

According to Salesforce Help:

https://help.salesforce.com/articleView?id=workflow_time_dependent.htm&type=5  (http://https://help.salesforce.com/articleView?id=workflow_time_dependent.htm&type=5 )
 
Time-dependent actions are executed at a specific time, such as 10 days before a record’s close date. When that specific time passes, the workflow rule re-evaluates the record to make sure that it still meets the rule criteria. If the record does, the workflow rule executes those actions.

So here is my situation:

I have a custom object, Instance, that stores Customer Identifier information for their subscription to our products. One of the fields is ExpirationDate, which indicates when their subscription with us expires.

A Customer can have multiple Instances, such as Trials, Sandboxes, and Production Instances.

The Instance object can be associated to an Opportunity. What we are trying to accomplish is that an Instance that is of Type "Trial" can have their "Expiration Date" extended if the related Opportunity is still in an open state. This way, we can allow the customer to continue extend their trial with us automatically until the Opportunity goes into a Closed stage.

To accomplish this, we have set up a workflow rule against the Instance Object, with the following rule:
 
AND(

CONTAINS("#Stage1#Stage2#Stage3#Stage4#Stage5#Stage6#Stage7#Stage8#Stage9#", "#"+ TEXT(Opportunity__r.StageName) + "#"),

NOT( ISBLANK( Expiration_Date__c ) )
)

Which basically checks to see if the Instance's related Opportunity Stage is a specific stage, and whether the Instance Expiration Date is not blank.

When those conditions are fulfilled, we have a Time-Based action that will run 4 days prior to the Instance.Expiration_Date__c to update the Expiration Date by a certain number of days.

The workflow rule works as described. However, there is a specific scenario that does not work.

When the Opportunity Stage that is related to the Instance is updated to a value that should fail the workflow rule criteria, the Time Based workflow action is still scheduled to run. This was not a problem to me, because I was thinking (as Salesforce Help has indicated above) that before the actual action is run, that Salesforce will re-evaluate the workflow criteria for the record to ensure that it still fulfills the conditions before running the action.

But what we are seeing is that, even though the workflow criteria is no longer fulfilled, the time-based action still runs.

Is there a reason why this is the case? And is there a better workaround for this?
ShirishaShirisha (Salesforce Developers) 
Hi Whyser,

Greetings!

I completely understand the scenario here and yes,it should re-evaluate the criteria before it process the schedule process.However,I would request you to capture the debug logs to see,if it is actually checking the criteria again or not to confirm from our end.

Meanwhile,can you please confirm what "Evaluate the rule when a record is" you have set for the respective workflow rule.

Once,you capture the debug logs and confirms that the criteria is not being checked before executing then feel free to salesforce.com support even if you have a basic/standard support as the documentation is incorrect.

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri