+ Start a Discussion
studiopikastudiopika 

time-delayed trigger

 

Hi,

 

We have a request to write a trigger to send out an email message at a specific time delay after a situation happened. Because of the complex logic this can't be done via workflow. Anyway to mimic those behavior in my own apex trigger code?

 

Thanks so much.

h8r41dh8r41d

You can use the schedulable interface to schedule Apex code similar to a cron job, for one time use or repeating use from within your trigger code.

 

See this page for details:

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm

 

 

Gabriel Alack
Contact Us - We Can Help!
Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x122

HariDineshHariDinesh

Hi,

 

Just write trigger as you need to implement complex logic.

At the same time use the Benefits of work flow to send email after some time, by updating some field in trigger and that cause the match of WF Entry criteria.

Use Time Depended actions for this which are available with WF.

 

But in this case mind that trigger can fire for bulk records update also and write code and Entry criteria accordingly.

 

studiopikastudiopika

 

Thanks for the suggestions. I'll try.