Salesforce Reporting API

Salesforce Reporting API

Salesforce Reporting API:

Salesforce, which is world’s leading CRM solution is used day in day out by millions of users across the globe. These users use salesforce to create a lot of data and store it in salesforce cloud database. Now, this data is of no use to end users if they cannot slide and dice it and extract meaningful information from it. This is where reporting comes into picture and becomes one of the main aspects of any CRM or any data based solution.

Salesforce provides us with an extensive reporting platform where users can create and customize reports and dashboards as per their requirements. On top of this platform salesforce also provides us with Reporting API using which we can extend the standard reporting functionalities provided by salesforce. In this article, we are going to talk about one such scenario where Salesforce Reporting API can be used to enhance the standard reporting tool.

Use Case :

On Opportunity object create a report to show total revenue generated per month for closed won opportunities.We need to show all the months even if data for few of them is not there in the system.

Issue :

In standard salesforce reports, when we drill down a report by month of a date field, salesforce does not show the line items for the month where there is no data. In many business scenarios, we might need a report or dashboard to show all the months irrespective of availability of data.

Solution :

To resolve this issues, we will use standard salesforce report and will use Reporting API to add columns for the months where data is not available. Below are the steps required to execute the use case.

Step 1:

Creation of standard salesforce report
•Drag the required fields on report and set the criteria.
•Set the report to a Summary Format and group by the close Date. Once the grouping is in place, you click the dropdown arrow next to the close date field name and choose to Group dates by – calendar month. Then click the dropdown next to the amount field and choose Summarize this field.

Step 2:

Creation of VF report with reporting API
With the help of report api we will use the Report of step 1 utilize apex wrapper class and pull the graph on visualforce page.


Below is a comparison of graphs between standard and custom report.
Observe that custom report displays even months where revenue was 0.

Reporting API