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
dev2014dev2014 

Apex Trigger on specific dates to specific accounts

Hi,

My client wants to use the Apex Trigger method.
The business logic we are trying to implement using apex trigger is the following. From the links below it seems like it's possible  to create a trigger that update a date field of the end of Quarter field date I created.

 

1.       Trigger starts when today date value= end of quarter date value  update accounts based on end of quarter date case formula (see  date field formula cases  and account record on sceenshots below  i.e. date(year(today()), 03,31),
date(year(today()), 06,30) etc,)

2.       Automatically select  Account list view of "My_large_accounts" list  view  (see screenshot below)

3.       Automatically select email contacts for those "My_large_account" accounts

4.       Automatically select  the assigned most updated email template to those "large accounts"  at the time of the trigger (email template could be updated manually before each end of quarter while still assigned to the same accounts)

5.       Send email to  those specific email contacts of "My_large_accounts"  every time the end of quarter triggers starts (When End of quarter field =todays field see account example screenshot)

I'm new to Apex trigger and trying to create the most efficient Apex Trigger to implement this. I would appreciate if you could refer  to similar Apex triigger code references or similar examples.

Thanks,



 

 

 

Based on the link below an date based trigger can be implemented.

 

Trigger to update the Date field one day less than to next year?

trigger dateUpdate on Pincode__c (before insert, before update)
{
    for(Pincode__c p : trigger.New)
    {
        p.X1st_Anniversary__c = p.Evaluation_Date__c.addDays(364);
        p.X6th_Anniversary__c = p.Evaluation_Date__c.addDays(2184);
    }

 

http://sfdc2u.blogspot.in/2013/04/trigger-to-update-date-field-one-day.html

 

http://salesforce.stackexchange.com/questions/20487/update-field-using-trigger

 

 

dev2014dev2014
Below are the screenshots

End of Quarte date field with date formula

User-added image

Large account list view that email needs to be sent
dev2014dev2014

Hi,

Further to the post above, I have a meeting with the client this Friday so it would be great if i can get some input from you  guys regarding references to similar code instructions to the  business logic steps above( I attached screenshots above as well) . I need it especially the first part where i need the trigger to start every time the end of quarter field is the same as the todays date fields using the formula above.

I'm new to Apex development  and Apex trigger development so I would a appreciate the quick Apex code reference input .The client want to use Apex trigger for this.

Thanks,