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
HarrySieHarrySie 

URL Hacking for passing Filters to Report

Hello, I've read a lot of things about URL Hacking to pass filters to a report. I've managed to create a report to pass all what I wanted to the predefined report and it worked in my sandbox. When I deployed it to production, it did not work. After that experience I caught the computed URL and typed it directly in. In sandbox the caught URL:  

https://cs11.salesforce.com/00OZ0000000VfBZ?pc1=00N00000008am9F&pn1=co&pv1=%22berlin%22 worked. In production I did the same, the report showed up, but the filter did not work. Has anyone a hint, what this might cause?

 

Thanks

Harry

bob_buzzardbob_buzzard

When you deploy your report/sobjects etc to production the ids will change.  pc1 looks like an id - does an object with that id exist on your production system?

HarrySieHarrySie

Hi Bob,

 

thanks for your advise, but the id of that custom field is the same in sandbox and production.

 

Best regards

Harald

bob_buzzardbob_buzzard

So is the filter value that you are passing the id of a custom field?  How does that work?

HarrySieHarrySie

Hi Bob,

 

yes the filter field is a custom object field. I've learned that this is the right way to set the filter field, and it works in sandbox. The filter in sandbox of the report looks then:

Equipment: Record Type equals SO - Global Rollout

AND OFT City contains berlin

where the first one is hardcoded and the second is the dynamic filter expression. In production the filter is only:the hardcoded part of the filter.

 

Thanks for your help

Harry

 

bob_buzzardbob_buzzard

Ah, so the id is actually the value of the custom field that you are filtering on, not the id.  That makes a lot more sense.

 

Does a record type with that Id exist in your system?

HarrySieHarrySie
Yes, there are more than 70.000 records with this id in sandbox, as well as in production. But when discussing this with you: I've setup the report in sandbox and in production. So it might be, that in production the setup of this report is slightly different to this in sandbox. I've checked therefore to see if the filtering field is in the layout of the report type in production and it is. To be sure I will deploy the report from sandbox to production and try again. Best regards Harry
bob_buzzardbob_buzzard

The other thing I'd try is to recreate the report in production, to check your filter values etc.

HarrySieHarrySie

Hi Bob,

 

deploying did it. Don't know why, but it works now. Will do some more testing and then deploying my apex code, that references this (new) report id again.

 

Thanks for your assistance

Harry