Archive for Configuration Category Feed

Auto Create Reports from Web Links

There is a little documented trick for building dynamic reports that can be launched from Web Links on a specific record. You can setup reports with pre-set criteria and pass the criteria values dynamically to the report through a URL string. To do so, pass the parameter values in the URL string where

pv0 is the value of the first parameter
pv1 is the value of the second parameter
pv2 is the value of the third parameter
and so on…

The URL would be:

https://na1.salesforce.com/id_of_the_report?pv0=value&pv1=value

Build this link this using a weblink or sforce control.

For example, suppose your company uses a Parent-Child account hierarchy. Suppose you do business with a number of GE subsidiaries and have a parent GE account is used to bring all of those accounts together. You want to easily run a report for all of the Opportunities related to the child accounts of that GE parent account.

To do this, create a Web Link to dynamically generate the report from an Account record.

Here’s how you do it:

Create an Opportunity report with the format you want. Add a single criteria line using the Parent Account ID field. Set the condition to “equals”. Leave the value blank. Save the report and note the URL of the report.

Create an Account web link that is a URL. The URL is “/id of the report?pv0={Account ID}“. Put that web link on the account page layout. When you run this report, the weblink will pass the Account ID into the first report criteria value. In this case, that’s the Account ID. So this report will pull all Opportunities where the Parent Account ID equals the Account ID of the Account record you clicked the weblink from. If you run that report from the GE record, it will pull up all Opportunities for child accounts of GE.

The parent-child situation is just 1 example. The concept can be used for a lot of situations where you cannot hardcode the criteria you need into the report.

Comments (10) comments feed

Next entries »