Building Custom Report Links in Salesforce

How do you build a custom report link in Salesforce that can change the outcome of the report based on the record the link is viewed from?

This article is a follow up from the Salesforce URL Hacking article I recently wrote. If you haven’t checked that out yet, or are a beginner in Salesforce URL hacking, I’d recommend reading it first!

I had a requirement from a user that needed to see all relevant activity history of the Account page, and was wondering if I could build out a dynamic field that listed all the information:

Salesforce Contact Replied field Request

After meeting with my colleague and getting a better understanding of their requirement, we came up with the idea to have a dynamically generated report placed on the Account Page layout.

How to Configure Custom Report Links

The requirement from my user would be to show the relevant completed tasks on the Account in a report, based on whatever Account record that they were viewing. Creating this solution is known as a Custom Report Link in Salesforce. Custom Report Links allow an Admin to create a Report based on the Salesforce ID of the record the link is placed on. You are able to associate whatever other filters on the report, and have them appear in this custom link as well.

The first step to create the Custom Report Link is actually creating the report itself. What you’ll want to do is go to the Reports Tab, create a new report, and open up the “Activities with Accounts” Report Type. You can easily do so by searching “Activities” in the Quick Find box.

How To create an salesforce custom activities link report

I sat with my colleague to figure out a specific account to develop some of the filters that they would consider “Notable Activities” in the Activity History section. We then created a report to include all the relevant filter information. For this example, we had the report filter look for all activities that had the subject contain “Call: Contacted”. Next, we added the Account ID of the specific account to the filter in the report. The ID was selected from the URL of the Account Record we were on.

All Completed Activities in Salesforce Reports with Relevant Filters
You’ll want to make sure that you are showing Completed Activities and that the Date Range is Null, so that it will search “All Time”.

Once the report was created and showed the ‘Notable Activity’ of that specific account, we edited the filter so Account ID would equal “”. This should show zero results in the report. The reason that we do this will be explained in the next section. Before we head there, we must do two quick things:

A) Save the Report with a unique name, and be sure to click the “Save & Return to Report” Button:

Saving the custom report link with a unique name.

B) Get the Report URL, and copy the Custom Report’s Unique Identifier:

SDR Noteable Activities Report Link

Creating the Salesforce Custom Report Link

Now we’ll be creating a the Custom Report Link for the Account page. You’ll want to be in your setup, and in the quick find box type in “Buttons”. Next, find the highlighted link under Accounts:

Buttons Links and Actions in the Salesforce Setup Menu

We’ll be creating a new Custom Button or Link. You’ll now paste in the Custom Report Link you have copied in the section B from above:

Customer Report Link for Account URL Detail Page

Passing Parameters through the Salesforce URL.

Are you familiar with passing parameters through a URL? If not, check out the Salesforce URL Hacking article. That should answer your questions you might have here.

The parameters you can pass are considered a Parameter Value, or PV for short. In software development, all arrays start with 0 (Zero). The first parameter is the Subject, or pv0, and the second parameter, pv1, is going to be the second filter in our report. We are able to send the Account ID from the page the Custom Report Link is going to be located. If you had multiple parameters you wanted to pass, you can chain them in the Salesforce URL.

Now we can save the Custom Link from above, and add it to the page layout.

Salesforce Custome Report link on Account Page Layout for Noteable Activities

When your users click the link in the above, they will be able to see the defined ‘Noteable Activities’ based on whatever Account Record they enter in from that custom link.

NOTE: You’ll want to make sure that your users don’t change the custom report (add/remove filters, etc), or it can affect the functionality of the link. You could save the report in a folder that users have ‘view’ access, but not edit or manage access.

Hope you enjoyed this article! Have you had any other Custom Report Links for alternate use cases? Please let me know your thoughts in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *