3

How can i identify the value for pc on report parameters when i use pc, pn and pv parameters to filter on the report? I am able to identify the names of standard fields, but unable to parse the custom fields and lookup fields.

  • What are pc, pn, and pv? – Shumon Saha Jun 16 '13 at 15:19
  • pc is the field that you want to filter on pn is the operator and pv is the filter value. Eg: To build Case status = Open as a filter on a report, you would add pc0=Case.Status&pn0=eq&pv0=Open as url parameters. – Ganesh Jun 16 '13 at 17:49
1

Custom fields will use the custom field Id. It will start with the key prefix 00N.

You can get the ID be browsing to the custom field in the App Setup and grabbing the ID from the query string.

E.g. https://na.salesforce.com/00O7000000xxxZG?pc0=00N70000001pOah&pn0=eq&pv0=true

Getting the Id of a Custom Field


Alternative method

Manually add a filter to the report on the required field:

E.g. Filter a Contacts report by related Account Name Adding a filter to the Report

You can then run the filtered report and extract the applicable pc*, pn*, and pv* values from the hidden inputs in the HTML source.

Here I'm using the Chrome developer tools to search for the "Testing" value I put in the filter. enter image description here

  • Thanks for the answer but that doesn't seem to work. Also, my object in question has multiple lookup to user and the report type brings in the same field from the different lookups. So if i use the field id, the system will still be confused as to which lookup it should refer to. For fields via lookup, is there anything else that needs to be used? – Ganesh Jun 17 '13 at 10:36
0

The filter Ids are specific to that Report Type. To find them, View Page Source on the report you're planning to hack. You will see a section of code something like this:

<optgroup label="Account: Address"><option value="ADDRESS1_LINE1">Billing Address Line 1</option>
<option value="ADDRESS1_LINE2">Billing Address Line 2</option>
<option value="ADDRESS1_LINE3">Billing Address Line 3</option>
</optgroup>

<optgroup label="Account: Custom Info"><option value="00Na0000009SDEn">_SYSTEM: AccountType</option>
<option value="00Na0000009SK3I">Primary City</option>
<option value="00Na0000009SK4Q">Primary Country</option>
...
<option value="00Na0000009SK4L">Type</option>
</optgroup>

Depending on the Report Type and the particular field, they may be the field Ids (prefix 00N as above) or reserved words, or they may be Ids unique to that Report Type. In some cases, the Id in the page source will look like FK_00Na0000009SK4L, and it has been important to use the FK_.

If your report type doesn't use the field Ids and has some other kind of Id in there, you will likely have to grab these values out of the page source directly. I have seen Ids that look like 072A0000002s6JU, that don't seem to be referenced anywhere else in the org. Anecdotally it seems to be only older Custom Report Types that use these different Ids.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.