**Introduction**
A common user requirement and indeed a basic one is to send an email of a scheduled report to the users only if the report is NOT empty.

To some extend this is now possible using the Salesforce standard functionality of Report Subscription. However, there are a few limitations:

  1. Users have to subscribe to the report themselves
  2. One user can subscribe to only 5 such reports
  3. The condition is application only to row and column aggregate/summary values

Here are some ideas on the idea exchange:
https://success.salesforce.com/ideaView?id=0873000000075I4AAI
https://success.salesforce.com/ideaView?id=087300000006n6Y
https://success.salesforce.com/ideaView?id=08730000000Df7IAAS
https://success.salesforce.com/ideaView?id=08730000000BpUfAAK
and many more…

Here are some links to the questions raised on the success community:
https://success.salesforce.com/answers?id=90630000000gssGAAQ
https://success.salesforce.com/answers?id=9063A000000sw83QAA
and many more…

In this blog post I will be describing a way to overcome the above limitations in a very simple manner. Read on….


The topic has 3 parts to it
1. Part 1: This very post that will cover sending email with a link to the report only if the total number of records are NOT zero i.e. not a blank report
2. Part 2: The next post (link here) will cover how to use some logic to set conditions/break points beyond the report aggregate values# 
3. Part 3: The third post (link to come here) will cover sending the actual data in the email template rather than sending the link to the report##

#This is more advanced than the break point we use in the standard Salesforce feature of “Subscribe to” report, which is limited to work on report aggregate values only. example: send email with report link only if a particular user has more than 5 open cases at the end of the day

##Ideally you would use this to send report data to employees who don’t have a login to Salesforce or those who don’t want to login into Salesforce (think management).

**Alternative**
An alternative to what I will be describing below is to filter emails with 0 record at the Email server or the Email client. So if this works for you, you may want to skip reading ahead. But I promise you if you do stick around you will enjoy.
— Thanks to Martin Keating to offer this alternative on the success community.

**Warning**
Developers keep away: No code required here (pun intended)
#AwesomeAdmins

Lets get to business now!

**Use Case**
The AwesomeAdmin at Company X has been asked to create a report on new opportunities created every day and send the report only and only if any new opportunities are created.

**Solution**

Some theory:
Step 1. Create the report
Step 2. An AwesomeAdmin like you subscribes to the report and sets “Post to Chatter Feed” when record count is > 0
Step 3: A process builder flow on “Feed item” that will send an email to all required users when the chatter post is made

Now to the practical:

Step 1. Create the report
I am going to skip the details for this one here, but basically we create an opportunity report to show opportunities created today. Like in the image below
screenshot (2).jpeg

Step 2.
screenshot (1).jpeg

Step 3.
Choose object as ‘Feed Item’ on the process builder
screenshot (3).jpeg

Define the criteria to include “FeedItem.Type” = “Text Post” and “FeedItem.Body” = report ID
screenshot (4).jpeg

Immediate action = Email Alert
screenshot (5).jpeg

The email template could look something like:

Hello,
There are new Opportunities created today. Please click here to view them.
Thank you.

Some limitations that will have to be dealt with workarounds:

  1. Limitation of 5 reports to subscription: A workaround would be to have AwesomeSuperUsers to help our AwesomeAdmin. Anyway, here is an idea out there to vote: https://success.salesforce.com/ideaView?id=08730000000DkodAAC
  2. Report subscription will fire based on the data visibility of the AwesomeAdmin. In all likelihood it will be “view all data”, which means that we need to keep in mind the data visibility of the users who we send the email with the report link. It may happen that a User receives the email but may not see any data.

And that’s it. Hope you enjoyed reading.

In the next post we will talk about how to subscribe to the report based on some advanced conditions.

Cheers!
SalesforceMann

Advertisements