2
  • I have created a new Salesforce report, added AccountID in the filter and left it blank.

  • Then while generating the report url I append pv0 at the end with AccountID

https://mydomain.salesforce.com/[Report_Id]?pv0=[AccountID]

This looks like a hacky way. Is there a better way to generate parameterized reports?

2 Answers 2

1

Below is a screenshot of a report criteria. There are three fields in the criteria that you will need to pass data to in order to fully control the criteria. enter image description here

pc0: Corresponds to the field in the report criteria.

pn0: Corresponds to the operator in the report criteria.

pv0: Corresponds to the value in the report criteria.

These inputs are 0 based that means that you will access the first set of filter fields using 0 (e.g. pc0, pn0, pv0). As you add more filters, you just increase the number (pc0, pc1, pc2...).

Now to the operators. Here are the values that Salesforce is expecting:

eq = equals ne = not equals lt = less than le = less than or equals gt = greater than ge = greater than or equals co = contains nc = does not contain sw = starts with in = includes

You can then append filter parameters at your leisure.

"/00OU0000000aYlZ?pc0=ACCOUNT_ID&pn0=eq&pv0={!Account.Id}&pc1=WON&pn1=eq&pv1=TRUE

For details click: hacking-cross-filter-reports

1

You can use few filters

pv0 = Account Id
pv1 = AccountType
pv2 = Custom field

This way you can construct url

/ReportId?pv0={!Account.Id}&pv1={!Account.Type}&pv2={!Account.Key_Account__c}

You can add like this.

Source: salesforce-reports-url-hack


Updates

/00O18000000Ldis?
ptable0=0721800000021Nf
&ocond0=w
&rtable0=CampaignMember-Campaign
&rtablecol0=Contact
&sfpc0_0=Name
&sfpn0_0=eq
&sfpv0_0={!Campaign.Name}

Notice the ptable0 is not a literal text such as ACCOUNT_ID, it's an Id. You can find it easily in chrome (right click on the filter and click inspect element) if you apply the cross filter to explore what values you need. You'll have to scroll up a bit until you see a bunch of

enter image description here

Just remember to remove the cross filter when you save the report.

Source Dynamic Report using Cross Filters

1
  • 1
    in addition to this excellent answer, if any of the pvX parameters are special date filters, you have to use the SOQL versions -- e.g. THIS_QUARTER as THIS QUARTER will not work
    – cropredy
    Feb 15, 2016 at 19:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .