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.
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.
Manually add a filter to the report on the required field:
E.g. Filter a Contacts report by related Account Name
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.
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
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.