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
bfunk3778bfunk3778 

Workflow not firing based on days from Oppty Close Date

Hi,

 

I have a workflow set up to auto Close Lost opportunities that are 30 days past their Close Date. 

 

Here's my formula:

and(
      or(

           ispickval( StageName,"Qualified"),

           ispickval(StageName,"Qualified Suspect")),

      TODAY()-CloseDate=30, 
      ispickval(Type ,"Renewal Business"))

 

I have an opportunity that meets all these criteria and the workflow has not fired.  Any thoughts? 

Best Answer chosen by Admin (Salesforce Developers) 
CaffeineCaffeine

If the record no longer meets the criteria, then the Time-based workflow will not fire (it is removed from the time-based workflow queue).

 

So one approach might be to set the time-based workflow on record creation with a filter: Status <> ClosedWon and Status <> ClosedLost.

 

Next create the Time-base action to execute 30 days after the Close Date.

 

Finally set the Action to be set Stage = 'Closed Lost'.

 

This should work fine.  If the Oppty goes to either the Status Closed/Won or Closed/Lost the Time-based workflow will be cancelled.

All Answers

CaffeineCaffeine

Bfunk,

On what event is the rule triggered?

 

You have three choices:

 

- When a record is created, or when a record is edited and did not previously meet the rule criteria
- Only when a record is created
- Every time a record is created or edited
 

 

 

bfunk3778bfunk3778
When a record is created, or when a record is edited and did not previously meet the rule criteria
CaffeineCaffeine

Ok.  Next question: how can you be sure that the record is going to be edited on the exact day that it is 30 days past the Close Date?

 

 

bfunk3778bfunk3778

So you're saying that SF doesn't count formula changes as edits? 

Like if I have a running formula that counts down number of days past Close Date and it reaches the threshold of 30 as set out in the workflow, it won't consider that an edit?

CaffeineCaffeine

That's correct. Something has to update a 'real' field on the record before the Workflow Rule will even be evaluated.

 

I think what you're looking for is time-based workflow, but even then you have to have a triggering event to kick off the timer.

 

Hope this helps.

bfunk3778bfunk3778

Ok let's say I use a Time Based workflow...

 

It would have to fire on Opportunity creation but the task or field update wouldn't happen until 30 days after Close Date. 

 

Something that's always confused me was how the Time based workflows monitor field criteria.

 

For example - if any of the criteria in the original workflow changes prior to the time trigger's due date will the task or field update not fire?  Is it smart enough for that or does it only base whether or not it will fire on the criteria at the time the workflow is triggered?

CaffeineCaffeine

If the record no longer meets the criteria, then the Time-based workflow will not fire (it is removed from the time-based workflow queue).

 

So one approach might be to set the time-based workflow on record creation with a filter: Status <> ClosedWon and Status <> ClosedLost.

 

Next create the Time-base action to execute 30 days after the Close Date.

 

Finally set the Action to be set Stage = 'Closed Lost'.

 

This should work fine.  If the Oppty goes to either the Status Closed/Won or Closed/Lost the Time-based workflow will be cancelled.

This was selected as the best answer
bfunk3778bfunk3778
Thanks!