+ Start a Discussion
rohit.mehtarohit.mehta 

Query Reports

Hello,

Is it possible to query Reports and retrieve its Id. Something like...

Code:
Select Id from Report where name='MyReportName';

 
I have a requirement where I want to redirect the user to a Report from my SControl. I dont see any Report object in the salesforce schema.

Thanks,
Rohit
SunilSunil

Hello Rohit,

You can redirect the user to a Report  using following code: -

 

Code:
<html> 
<script type="text/javascript"> 
function init() { 

If(.....)
{
opener.location.replace("https://na2.salesforce.com/00O38800000cO1N"); 
}
} 
</script> 
<body onload="init()"> 
</body> 
</html>
https://na2.salesforce.com/00O38800000cO1N is the URL of the report where you want to redirect the user.

Thanks



Message Edited by Sunil on 12-15-2008 12:03 AM
kool_akool_a

Hey, I know it has been a while but did you find a solution to this issue. I want to use the report name to fetch the report Id, the report id might change in production.

 

Thanks

rohit.mehtarohit.mehta

Reports is meta data and not a SObject so you cannot query.

Recommend using custom setting. That way you can have the report Id externalized from the code.

 

Thanks

kool_akool_a

Although i don't remember what custom settings are i will look into it.

 

Thanks, i really appreciate the fast response.

VarunCVarunC

rohit.mehta wrote:

Reports is meta data and not a SObject so you cannot query.

Recommend using custom setting. That way you can have the report Id externalized from the code.

 

Thanks


How can we use CustomSetting to give me ReportID value? Can you please summarize how to use them? 

 

I'm running into same issue and could not implement the solution using CustomSetting too. 

 

I need to read ReportID in user's Org, using ReportName. The ReportID cannot be hardcoded into the URL, I need to generated Dynamically using ReportNam.

Jasvinder Singh 8Jasvinder Singh 8
If we create a Tabular Report containing ID as one of it's fields and a Summary Report grouped on ID, then can we create a joined report joining these 2 reports on the ID field?