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
AUEagleAUEagle 

Calling a custom search page from controller

I am building a custom search page which calls a custom report which I have created.  The report is assigned a unique Id at the time of creation.  The report Id assigned in my test sandbox is '/00OT00000017uln?' and I am able to call the report and pass parameters by using the following: sURL = '/00OT00000017uln?' + Filter + '&retURL=/apexCustomSearch?sfdc.tabName=01rT0000000DEIN';
        PageReference pageRef = new PageReference(sURL);
       return pageRef;

 

However, when I move to a production environment, the unique ID will be different although the assisgned name will be the same.  Is there a way I can call the report using the assigned name or retrieve the unique ID using the report name?

AhmedPotAhmedPot

Hi,

 

You can create custom label which will store report id. and refer the custom label in your controller.

 

ex.

return new pagereference('/' + Label.CRV_Report .

 

This way you just change the report id in your custom label, no need to change your code when you move it in production.