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

Getting field id for CreatedDate on sObject for use in dynamic report via pc0, pn0, pv0?

I'm writing some apex/visualforce to let users open reports using dynamic filtering by passing the pc0, pn0 ,pv0 parameters in the URL. However, it seems that you can not use this method to filter on CreatedDate. When I add CreatedDate filtering to a report and look at the source of the resulting page I see the pc0 field set to the SalesForce ID of the CreatedDate field rather then the api name.


So, my question is, can I get the SalesForce Id for a field using the schema?


I don't believe that's possible - we've had to put this kind of information into custom settings.


That's what I thought/was afraid of. Very frustrating that you can pass other fields without issue, but date fields simply don't work.


One possible solution is to add a formula field to the object that looks up to the created date and then pass the custom field to the report.