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

3.5K    Asked by AyushiKhatri in Data Science , Asked on Apr 23, 2021

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?

Answered by Clare Matthews

You can send automated reports to your clients. Send them to any email address and also non-Salesforce users. To create a new report, or your first one, click the New Schedule button. Once you created reports, you can easily manage them from here with edit, send now, and delete.


Classic and Lightning report refresh subscriptions work a little bit differently, but neither is capable of sending a message to an arbitrary email address outside Salesforce. You can email users and groups who have Salesforce accounts for delivery to email addresses that are set on their Salesforce profiles.

Per Schedule a Report for Refresh,

You can send reports only to email addresses included on Salesforce user records.

Per Subscribe to Get Refreshed Report Results in Lightning Experience,

When the subscription emails the refreshed report to each recipient, it sends to the email address set in Settings | Email | My Email Settings. If no email is set in My Email Settings, then the refreshed report is sent to the recipient’s email address set on their Salesforce User record.

The easiest solution is likely to be a forwarding rule on your corporate email server. Running the report in Apex and generating and sending emails in code would be substantially more complex.



Your Answer

Answer (1)

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.









6 Months

Interviews

Parent Categories