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
bhagibhagi 

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

SFDC_EvolveSFDC_Evolve

I think You use below method ,,

 

today()-addMonths(-2);

 

This will give 2 months Back date . . :)

PhoenixedPhoenixed

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.