I am new to learning apex code and have a scenario where we need to open a salesforce tabular report using the report’s name. I have created VF tab, visualforce page and kept the tab in homepage already. Below is what I tried in VisualForce Markup and a new page opens but doesn’t display the report. Could you please help me with what I could be missing. I appreciate it!
`<apex:page>
<script>
var reportName = "Employee Info";
var result = sforce.connection.query(
"SELECT ID "+
"FROM Report " +
"WHERE Name = '" +reportName+ "' " +
"LIMIT 1"
);
var URL = '/'+result;
var win = window.open(URL,"target=_blank");
window.history.back();
</script>
</apex:page>`
Below is what I tried in VisualForce Markup and a new page opens but doesn’t display the report. Could you please help me with what I could be missing. I appreciate it!
<apex:page>
<script>
var reportName = "Employee Info"; var result = sforce.connection.query( "SELECT ID "+ "FROM Report " + "WHERE Name = '" +reportName+ "' " + "LIMIT 1" ); var URL = '/'+result; var win = window.open(URL,"target=_blank"); window.history.back();
</script>
</apex:page>
bibar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.