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
s_macs_mac 

apex scheduler to send emails

Here I want my apex scheduler to send emails on daily basis,
where email body :should have the list of contacts created today,ie., contacts and its related account..,this list should look like a csv file
email to: emails should be sent to respective account owners, having information of individual account and related contacts.


Can this be done using apex scheduler class.Any help would be appreciated..Thanks in advance..
Balaji Chowdary GarapatiBalaji Chowdary Garapati
@s_mac:

The answer is yes! and here is how:

  First you might need to write a batch job which holds your logic. And a scheduler class which can be scheduled at regular intervals to run this batch job.

If you would like the user to see them as a table and lot more details in an organized fancy way instead of a plain list of contact names and their urls,then you might need to create a visualforce page email template, which displays data in your required format and use it for emailing.

Use ful links:

Batch Job:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm

Scheduler:

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

Visualforce Email Tempalte:

http://www.salesforce.com/docs/developer/pages/Content/pages_email_templates_intro.htm
http://www.salesforce.com/docs/developer/pages/Content/pages_email_templates_creating.htm

Things to be cleared before coding:

  1) Does user need 1 email with all the contacts grouped by account name that he owns which were created on that day?
  2) Should there be links in visualforce email templates which land them on that particular record?


Hope it helps.,



Thanks,
Balaji

 
s_macs_mac
@Balaji Chowdary Garapati

Yes, user need an email with all the contacts created today, grouped by account that he owns..
Vertex AdminVertex Admin
@s_mac

Do you have any sample code for this requirement?

Can you please share the code..

Thanks,
Murali Reddy