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
Stefano AmentaStefano Amenta 

Embedding report in VF page

Hi,

I'm trying to embed a summary or tabular report inside a Visualforce page.

Initially, I was using this code but it doesn't work if the report doesn't have a chart.
 
<apex:page standardController="Visa__c">
<apex:sectionHeader title="Visa Cases Assignment"/> 
<apex:form >
    <apex:outputPanel>
        <analytics:reportChart reportId="00O0E000000ecW2" > 
        </analytics:reportChart> 
    </apex:outputPanel>
</apex:form>   
</apex:page>

What's the best way to embed in VF a report without any chart?

Thanks.
Stefano​​​​​​​
Stefano AmentaStefano Amenta
I also tried to use iframe in this way:
 
<apex:page standardController="Visa__c">
<apex:sectionHeader title="Visa Cases Assignment"/> 
<apex:form >
    <apex:outputPanel>
    <apex:iframe src="https://cs89.salesforce.com/00O0E000000ecW2?isdtp=lt" scrolling="true"  height="1588px"  width="100%"/>   
    </apex:outputPanel>
</apex:form>   
</apex:page>

I have added the VF page inside a tab but when I click it I get the error "cs89.salesforce.com refused to connect."
Khan AnasKhan Anas (Salesforce Developers) 
Hi Stefano,

Greetings to you!

analytics:reportChart will work only with charts. According to Salesforce doc: Before you add a report chart, check that the source report has a chart in Salesforce app.

You are facing this issue with iframe because the Clickjack Protection settings are enabled. You will need to disable these settings.

Setup->Security Controls->Session Setting

To disable the Clickjack Protection, please raise the case with Salesforce Support as you will not able to disable it. Also, I think you cannot disable it in developer org.

However, you can use jQuery rather than an iFrame.

Please refer to below links which might help you further.

https://salesforce.stackexchange.com/questions/33003/reports-embedded-in-visualforce-not-showing/85676#85676

https://developer.salesforce.com/forums/?id=906F0000000Ayj5IAC

https://developer.salesforce.com/forums/?id=9060G000000MUsqQAG

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas
Stefano AmentaStefano Amenta
Hi Khan

Thanks for the reply.

As I live in China, where Google is blocked, do you know if there is an alternative API instead of https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js ?

Best.
 
Khan AnasKhan Anas (Salesforce Developers) 
You can use Microsoft's CDN:

https://docs.microsoft.com/en-us/aspnet/ajax/cdn/overview

Please refer to below link for more information:

https://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go

I hope it helps you.

Kindly mark this as solved if the information was helpful.

Thanks and Regards,
Khan Anas