Microsoft Gold Azure and Dynamics CRM Partner | Salesforce Experts

Last month, I had the pleasure of presenting as part of the Girlforce Skillshare about Salesforce Formulas along with my colleague, Beth Howard, and some other rad women in the Salesforce scene. I focused my presentation on Salesforce URL hacking using pv0. In this post, I’m going to spend some time diving further into the same topic.

I learned about URL hacking using pv0 when I attended Dreamforce for the first time back in 2011. URL hacking with pv0 is the process of using merge fields in a custom link or URL button. Examples of use cases include:

  1. A custom button to prepopulate fields on a new record with values from the source record using merge fields (though I’d suggest using Actions where you can on this since they are officially supported)
  2. A custom link on an Account page or Home Page sidebar populating report filters with values from the source record or running user

I’ll focus on the second use case in this blog post as the officially supported Action feature can be used to solve the first use case. Let’s say you need to make report results more dynamic, but there aren’t standard filtering options for the field you want to filter. For example, the standard Opportunities report type includes some standard dynamic filtering options based on the Opportunity Owner and Teams:

 

Opportunity Report

 

These options dynamically filter the report results based on whoever is viewing the report. With pv0, you can essentially transform fixed report filters into dynamic filters based on how the running user navigates to the report. In this example, we will filter on Opportunities for a specific Account. Creating a custom link on the Account object will allow you to create one report and basically use it as a template for an unlimited number of Accounts without having to re-create (and manage) multiple instances of an otherwise identical report.

First, you need to create your report “template”. Mine is called Closed Opportunities All Time and uses the standard Opportunity report type:

 

Report Parameters

 

Next, copy the report Id from the URL of the report:

 

Report ID

 

Go to Setup > Customize > Accounts > Buttons, Links and Actions to create your Link. I named my custom link “Won Opportunities”. It’s on the Account object because I want to place the link on the Account page layout. This allows us to pass values to the report from the Account record the user is viewing when they click the link:

 

Custom Link

 

You may have noticed I didn’t include the https://na8.salesforce.com portion of my URL. That’s because Salesforce allows you to leave off the domain of your instance, enabling you to move URL related formulas between environments without breaking your link.

The “pv” in pv0 stands for “parameter value”, where “0” is the location of the value you want to set. You can also set pv1, pv2, pv3, etc. Since we’re only passing a value for one parameter, you only see pv0 for this example.

Next, you need to add your link to your page layout to test it out:

 

Page Layout

 

Clicking the link from the United Oil & Gas Corp. Account opens this window:

 

pv0Report

 

Check out the URL of the window – you can see where the merge field was replaced with the Account Name for the United Oil & Gas Corp. Account!

A few disclaimers: It’s called a hack because it’s not officially supported by Salesforce. It’s not supported in Lightning yet, but if you are looking to create a new record using pv0, you should use an Action instead. Since it’s not an official feature, Salesforce does not guarantee it will work for future releases. However, they are aware how many people would be upset if they didn’t! Even though it is a hack, I’ve found it extremely useful. It can really make your reports go the extra mile for your end users.

Last but not least, if you want to see the live demo, including an example using multiple parameters, you can view the full Girlforce Formulas Skillshare video in all of its glory by clicking here!