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
ArtemiyArtemiy 

Send email with report details

I am newbie in Apex development, so I hope somebody can help me.

I would like to know is there any way to send email with report details? If yes - how can I do that?

 Probably someone has this script already and can give me some advises. I'll appreciate any help in this question.
paul-lmipaul-lmi
the short answer is yes.

the long answer is that your code would have to do the following:

* an SOQL query that gets the same data your report would
* an outbound email that contains the output results of the above query
* a testMethod for the query
* a testMethod to cover the outbound email

the other note is that SFDC doesn't give you any way to automate/cron this action, so it has to be triggered by something/someone.

the Apex Developer Guide has tons of documentation and examples on the outbound email and SOQL queries.

Good luck!