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
PronowPronow 

Formula field or Auto-update field do not trigger Workflow Rule

Hello there,

 

In my project, on an object I have two fields. One is an auto-update and other is a formula field. Auto-update field contains 'Current Date' value ( 'TODAY()' ). Formula field is number type, calculating difference in days between a custom DATE field and above auto-update DATE field.

 

I am trying to trigger, a workflow rule that will fire when value of formula field would be 30 or 60.

 

Please help me out as the workflow is not getting triggered when the above formula evaluates to true.

 

Thank you in advance.

Best Answer chosen by Admin (Salesforce Developers) 
PronowPronow

Thank you for your response.

 

However, I guess you did not get the actual problem that I faced. The workflow is supposed to fire when the auto-update field i.e. Current date will change. The other field is formula field calculating No. of days between two dates. One is Cutom date field and other is Current date.

 

Even if I try to fire a workflow to update either Current date or No. of days, you need to update that particular record.

 

So, as a conclusion I found a solution to write a Schedular that will fire everyday, and it will calculate no. of days and update it. This will cause all dependent workflows to fire.

 

I implemented this solution in my project, and its working fine and uninterrupted now.

 

Thank you for your knowledge sharing.

All Answers

bob_buzzardbob_buzzard

Workflow doesn't fire on formula fields, as the field isn't stored in the database and so doesn't get updated.  What happens is when you retrieve the record, the value is calculated and the field populated.

 

There's a couple of ways around this:

 

(1) Don't use a formula field, but use a regular field and a workflow field update that replicates the formula.  That way the field will be stored in the database.

(2) Replicate the formula in your workflow rule and fire it every time a record is created or edited.

Hengky IlawanHengky Ilawan
Hi Bob,

I am using a workflow that gets fired when the value of a formula field changed, and it works perfectly.
Is there other conditions that can prevent workflow on formula field to fire?

-Hengky-
bob_buzzardbob_buzzard

If the formula field is the only thing that changes, this will not cause a workflow to fire:

 

http://success.salesforce.com/ideaView?id=08730000000BrIGAA0

 

However, if fields that contribute in to the formula field change, that will trigger it.

 

So for example if the formula field is to pull in a value from a related object, a change to the related object won't cause the workflow to fire.

PronowPronow

Thank you for your response.

 

However, I guess you did not get the actual problem that I faced. The workflow is supposed to fire when the auto-update field i.e. Current date will change. The other field is formula field calculating No. of days between two dates. One is Cutom date field and other is Current date.

 

Even if I try to fire a workflow to update either Current date or No. of days, you need to update that particular record.

 

So, as a conclusion I found a solution to write a Schedular that will fire everyday, and it will calculate no. of days and update it. This will cause all dependent workflows to fire.

 

I implemented this solution in my project, and its working fine and uninterrupted now.

 

Thank you for your knowledge sharing.

This was selected as the best answer
Angadsingh JulkaAngadsingh Julka
Pronow, can you please help me with the code which you have used for the trigger.

Even I am facing the same issues.

Thank you!
Geovanni AlvaradoGeovanni Alvarado
Pronow, can you please share the schedular you wrote to understand your solution. thanks in advance.