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
CaitlinGMCaitlinGM 

Trigger for time-dependent action

I need to send an email to a contact associated with a record (through a lookup field) one week before a date in the record's "End Date" field. 

 

I can't use workflow for this because the email doesn't go to a set contact, but rather it depends on the field contents. 

 

I can write an apex trigger to send the email, but how do I incorporate the time-dependent aspect? 

 

Would it work if I set a workflow rule to check a checkbox field a week before the deadline, and write the trigger to be an "on update" trigger and say that the field must be checked? Would the workflow-induced field update set off the trigger? 

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

A workflow induced field update would indeed set off the trigger.

 

 

 

All Answers

bob_buzzardbob_buzzard

A workflow induced field update would indeed set off the trigger.

 

 

 

This was selected as the best answer
CaitlinGMCaitlinGM

Great, that's what I'll do, then. Thanks.