function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bperry8086bperry8086 

How get field ID for a custom link?

I want to add a new filter condition to a report when I visit it via a custom link.  I know how to get the field ID for a custom object's fields.  I know how to get the field IDs for standard objects.  How do I get the ID for a custom object's standard fields?  Specifically, I want to use the Name field of an object as the field to filter on.

 

So far, my added filter condition hasn't even appeared when I click the link.  I suspect this is because I've failed to find the proper ID thus far.  I am filling in parameter pc4 with the ID value, Of course, pn4, and pv4 are getting appropriate values too.

Best Answer chosen by Admin (Salesforce Developers) 
Greg HGreg H

It might make sense to drop all of the parameters except the one with the issue for the sake of troubleshooting. Can you make a copy of the report with Id 00O00000009rjh9 and save it with no predefined filters. Then try accessing the report with the following logic for your button/link:

https://ssl.salesforce.com/00O999999999999?pc0=CUST_NAME&pn0=eq&pv0={!SchoolDistrictProgram__c.Name}

Where you replace the 00O999999999999 portion of the above string with your new report Id. Then when you access the report from the link you should at least see if the filter gets applied to the report when accessed via the link/button.

-greg

All Answers

Greg HGreg H

Use "CUST_NAME" instead of the Id. I believe that will work for you.

-greg

bperry8086bperry8086

I've had no success so far at getting my pc4 parameter set.  I can set pv4 and pn4 with the code below, but as soon as I try to add pc4, that whole line of the filter is dropped from the resulting report

 

https://ssl.salesforce.com/00O00000009rjh9?
pv2={!SchoolDistrictProgram__c.Program_Cycle__c}&
pv3={!SchoolDistrictProgram__c.StateProgram__c}&
pn4=eq&
pv4={!SchoolDistrictProgram__c.Name}&
pc4=00N00000008ifiq

 

This is a problem even if I'm using the IDs of custom fields.  I also want to know how to do this using the name field on a custom object.  I also tried using pc4=CUST_NAME as suggested above, but the results were the same.  I'm missing something, but I don't know what.

 

Note: the report has 5 filters.  Filter 5, the one refered to by pc4, pv4, and pn4, does exist in the report.

Greg HGreg H

It might make sense to drop all of the parameters except the one with the issue for the sake of troubleshooting. Can you make a copy of the report with Id 00O00000009rjh9 and save it with no predefined filters. Then try accessing the report with the following logic for your button/link:

https://ssl.salesforce.com/00O999999999999?pc0=CUST_NAME&pn0=eq&pv0={!SchoolDistrictProgram__c.Name}

Where you replace the 00O999999999999 portion of the above string with your new report Id. Then when you access the report from the link you should at least see if the filter gets applied to the report when accessed via the link/button.

-greg

This was selected as the best answer
bperry8086bperry8086

I hit on a slightly different solution, but I'm going to credit your answer as the winner.  The suggestion to start with a report with one filter only is a good one.  It's also useful to start working with a simple report type (just one object) if you can.  If you jump into a situation where there are multiple objects, it can be confusing to figure out exactly how to refer to your field in the formula editor.  This is especially true if the fields are not always named consistently from object to object. 

 

The key to my fix was to add an additional filter to the report.  In my case it looked like "School District name not equals ZZZ".  That's a filter that will always be true when unmodified.  In my report link, I would override the pn and pv parameters with  "eq" (equals) and the name of the district to report on.  That let me avoid overriding the pc parameter for the name field.

 

All is now well and I've avoided re-creating 9 existing reports.