You need to sign in to do that
Don't have an account?

Help On Triggers
hi..
i wrote trigger on contract object.and it have some fields like start date,end date..and the contract period is 1year.but my need is before 60days of end date email will sent to the user..
i write the trigger..and i add the function today() the email is came..but how to add the 60days before of end date??
can anyone suggest me please??
Thanks&Regards
Bhagi.n
I think You use below method ,,
today()-addMonths(-2);
This will give 2 months Back date . . :)
Hi Bhagi,
Trigger will not help you in this case, As trigger works on DML operation and you need to send the email before 60 days prior to some date field.
You can use Time Based workflow or Batch class to execute your logic.
Thanks,
Phoenixed.
Apex Scheduler could work:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm