877.703.4488 info@cloudmybiz.com

Reports are an awesome tool in Salesforce. In a matter of minutes, you can filter, group, and summarize your data in countless ways to give you exactly the information you need and reorganize it in seconds. But let’s say your team constantly needs to see a very specific Report based on information from a record. Maybe you want to quickly see how much revenue is being generated by accounts in the same State as the one you’re looking at, or what Cases have been opened by people from the same company while you’re working on a support ticket. Your team could all constantly update the same Report or you could create an individual Report for each circumstance, but that means slowing down the process or filtering through thousands of Reports. Wouldn’t it be easier if you could just have one Report that was smart enough to always give you the information you need right now? Well, you can with dynamic Reports in Salesforce!

This is the quick and dirty guide to creating dynamic Reports for those of you with too little time in your day. You’ll probably want to grab a cup of coffee like you did when you read our URL hacking guide, but know that this is only skimming the surface of what you can do with dynamic Reports.

So, start off by creating a Report – we’ll call our example Opportunities Won by State. Add all the fields your team needs. Next, add the filters you want to apply starting with the ones that need to be dynamic. To make your life easier, throw in values for those filters rather than leaving them blank so that you can see what the Report will look like when it works. In my Report, the first filter in my Opportunity Report (which should be dynamic) is Billing State equals CA, and the second (which should always stay the same) is Stage equals Closed Won. Save your Report to a public folder, and make a note somewhere of the Report ID (the 15 character code after salesforce.com/ in the URL – see example below) and the exact order of those filters.

https://na8.salesforce.com/00O60000003ioH4

Now, go to the object where you want to access the Report from (I want to see mine from Accounts) and create a new Custom Link. Be sure the Content Source is set to URL, then in the big box, enter a /, the Report ID, and a ?. It should look like this:

/00O60000003ioH4?

Almost done! Now comes the fun part. We need to tell the Report what parameter values (pv’s) to use. When I created my Report, my first filter, or parameter, was Billing State. So I’ll start by typing pv0= (note the 0 – Salesforce starts the count from 0 rather than 1 here). Next, I’ll select the merge field I’m looking for using the formula editor to insert, or if I know the API name, I can just enter it in the format of {!sObject.Field}. It should look like this:

/00O60000003ioH4?pv0={!Account.PostalCode}

Let’s say I had one more filter that I wanted to be dynamic. I don’t just want to see Opportunities from this State, but ones referred by the same Account. Just add an & (no spaces) in between each value and increment the number after pv:

/00O60000003ioH4?pv0={!Account.BillingState}&pv1={!Account.Referred_by_Account__c}

Once you’ve finished setting up the link, save it, then add it to your page layout. Go to a record and click on the link to test. Sometimes you’ll find that you may have mixed up your pv’s or that the filters are too restrictive or too open-ended and you’re not getting the data you need. If that happens, open up your Report in one tab, your Custom Link in another, and a sample record in a third. This will allow you to quickly make changes to your Link and Report and see the results. Once you’re totally satisfied, let your team know about the awesome new feature that’s already waiting on their page layouts and treat yourself to another well-deserved cup of coffee!

-Jared and the Salesforce Guys

Share