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
bavanabavana 

Can we create apex triggers for time based workflow rules

Can we create apex triggers for time based workflow rules.. if so give me one simple example 

sfdcfoxsfdcfox

Triggers will execute if the time-based workflow rule creates or modifies a record. This means that a time-based workflow rule can create a task and it will execute (before and after insert) task triggers, or you can use a Workflow Field Update to change a field value, thus triggering (before and after update) object triggers. Those triggers can, in turn, trigger a time-based workflow.... Before scheduling, people used this mechanism to create recurring system tasks.

 

As for examples... I have no idea what might interest you. Simplistically, you might have a delayed workflow rule that checks to see if a date field has a value, and if so, trigger a field update when that date comes up. You might also have a trigger that checks the value of that field, and if it is the current date, then update another field and create a clone of the record with new information. This setup might be used to create automatically recurring opportunities, for example. It's late, and I'm tired, but I'm sure I could dream up all sorts of other nifty things you could do with this. Of course, with scheduling, this sort of setup is less useful than it was previously, but it still has some purposes, such as if you create a custom roll-up summary trigger to accommodate some scenario that prevents regular roll-up summary fields from working.

salesforce expertsalesforce expert

can you be specific on your requirement so that i could provide you more assistance!

 

-baskaran

Navatar_DbSupNavatar_DbSup

Hi,

 

You can execute the trigger base on the time dependent workflow.

 

In the time dependent work flow you can update a field. when field will get updated then trigger will execute.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.