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
SELVARAJ SUBRAMANIANSELVARAJ SUBRAMANIAN 

Salesforce Reports in Visualforce pages

I have requirement where I have to embed a Salesforce report into my site which is running on salesforce platform.

I am trying with the below code, 
<apex:outputLink html-location="0" value="{!sfInstanceURL}/?startURL=/00On0000000JVvp&isdtp=nv&oauth_token={!sfOAuthToken}" rendered="true" target="_blank">SF Report</apex:outputLink>

And the generated URL looks like this,
https://cs30.salesforce.com/?startURL=/00On0000000JVvp&isdtp=nv&oauth_token=00Dn0000000Dccu!AQkAQIazITJ1oIAoQU2UljR5AZHe_auKkNrSkuQwWJqVjPZc2C3lB4JfCLD9jePAYFpBJX8rsNVPElqZm9YHR27U9X_UPzZI

But getting an error message as, "**Unable to Access Page**
The value of the "oauth_token" parameter contains a character that is not allowed or the **value exceeds the maximum allowed length**. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information."

Am I missing something here??? can someone help me to resolve the issue...
 
Andy BoettcherAndy Boettcher
*Officially*, you cannot embed a Report on a Visualforce page with the approach you are using.  You can use the analytics:reportchart component to put a chart on a Visualforce page however.  (https://www.salesforce.com/docs/developer/pages/Content/pages_compref_analytics_reportChart.htm)

If you want to put report data on a page - you can use the Analytics API to pull that data and render it however you want.
SELVARAJ SUBRAMANIANSELVARAJ SUBRAMANIAN
Hi Andy, Thank you for your reply.

I have tried with three options as given below,

1. Using the outh_token - which doesn't help
2. Using the forcetk api to get the data and build the graph / chart. - It worked - Since we have the reports already in Salesforce we don't want to re-invent the wheel again.
3. Using analytics:reportchart - This works only when I run with in salesforce, and not working when I try to use in one of Forece.com site.

And also we are trying to implement SSO to access the reports directly without prompting the user to enter credentials.

Please note that my site will be a different domain like (mycomp-cs30.force.com) and the salesforce reports will be in a different domain (cs30.salesforce.com).

So is there any other way to access the reports???

Thanks,
Selva


 
Andy BoettcherAndy Boettcher
I would urge you to read up on the Analytics API to access this information in the manner you are looking to do it.
SELVARAJ SUBRAMANIANSELVARAJ SUBRAMANIAN
Sure, I will get back soon
theDtheD
On a related question, i am using analytics:reportchart in a VF page but when rendered on mobile device it does not drill through to report. 
Is this as designed or ?