Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Data Science
  3. Question
Data Science

How do I send report results to non Salesforce users by email?

Asked by Ayushi Khatri Apr 23, 2021 5.7K views 2 answers
Share

About this question

I am trying to automate a report by scheduling the report to run at a date/time and emailing the results to mail group. How do I send report results to mail group?

Apparently via the standard Salesfore functionality that is not possible that is why I need to know is there any other way and workaround to be able to send a scheduled report to mail group? How to schedule report salesforce for non salesforce user?

Your answer

2 Answers

Ranjana Admin JanBask Expert Latest answer

Answered on Jun 10, 2024

To send Salesforce report results to non-Salesforce users via email, you can use several methods, including exporting the report and manually sending it, using third-party integration tools, or leveraging Salesforce's native email capabilities. Here’s a detailed guide on these methods:

Method 1: Export and Manually Send the Report

1. Export the Report:

  • Run the report in Salesforce.
  • Click on the "Export" button.
  • Choose the export format (Excel or CSV).
  • Save the exported file to your computer.

2. Send the Report via Email:

  • Open your email client (e.g., Outlook, Gmail).
  • Create a new email.
  • Attach the exported report file.
  • Enter the recipients' email addresses (non-Salesforce users).
  • Add a subject and body content as needed.
  • Send the email.

Method 2: Use Third-Party Integration Tools

Several third-party tools can automate the process of sending Salesforce reports to non-Salesforce users. These tools can schedule and send reports directly via email. Some popular tools include:

1. Salesforce AppExchange Apps:

Apps like Report Scheduler or Keen Report Scheduler allow scheduling and emailing reports to any recipients, including non-Salesforce users.

2. Zapier:

  • Zapier can connect Salesforce with email services like Gmail or Outlook.
  • Create a "Zap" that triggers on a specific schedule or event (e.g., new report generation) and sends the report via email.

Method 3: Use Salesforce Native Email Capabilities

Salesforce has built-in capabilities for sending reports via email, but by default, this is limited to Salesforce users. To extend this capability, you might need to:

1. Create a Public Group with External Email Addresses:

  • Create a public group in Salesforce and add non-Salesforce users' email addresses.
  • Use this group when scheduling report emails.

2. Schedule and Email Reports:

  • Go to the report you want to schedule.
  • Click on the "Subscribe" button.

Set the schedule (daily, weekly, etc.).

  • Add the public group with external email addresses in the recipient field.
  • Configure the email content and frequency.

Save the subscription.

  public class ReportEmailSender {    public void sendReportEmail() {        // Query the report data        List reportData = [SELECT ... FROM ...];                // Convert report data to CSV or HTML format        String reportContent = ...;        // Send email        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();        mail.setToAddresses(new String[] {'externaluser@example.com'});        mail.setSubject('Report');        mail.setPlainTextBody('Here is the report you requested.');        mail.setHtmlBody(reportContent);        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });    }}

Schedule the Apex Class:

Schedule the Apex class to run at specified intervals using the Salesforce scheduler.

  public class ScheduledReportEmail implements Schedulable {    public void execute(SchedulableContext sc) {        ReportEmailSender sender = new ReportEmailSender();        sender.sendReportEmail();    }}

Set Up the Schedule:

  Use the Salesforce user interface or Apex code to schedule the class.String cronExpression = '0 0 12 * * ?'; // Every day at 12 PMSystem.schedule('Daily Report Email', cronExpression, new ScheduledReportEmail());

Conclusion

Sending Salesforce report results to non-Salesforce users via email can be achieved through manual export and email, third-party tools, or custom Apex solutions. The choice of method depends on the frequency, volume, and level of automation required for your reporting needs.









Was this helpful?

More Data Science discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Data Science Blogs

Guides, tips and career advice on Data Science from JanBask experts.