+ Start a Discussion
anitha12anitha12 

Unable to create reports using Iframe

Hi All.

When I am including a reeport in  Iframe I am getting this error:

Refused to display 'https://ap1.salesforce.com/00O90000007bVAv?isdtp=mn' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

can wny one pls help me very urgent.

Thanks in Advance.
Anitha
ShashankShashank (Salesforce Developers) 
This happens if "clickjack protection for not-setup pages" is enabled in your org. Please see this: https://success.salesforce.com/answers?id=90630000000hgmCAAQ

YOu can instead use the new analytics components to include reports in a vf page, as mentioned in it.
anitha12anitha12
Hi shashank,

Thanks for your reply. If I use a re port  chart for displying report. It is redirecting to other page.Actaully I am having visualforce filter.  I need to integrate both VF filter and Standard Report. Whether it is possible or not? Using my code it is working but it is rediecting to other page. How can I achieve this pls help me.

My Controller:
public class Newfcntrl{
    public string locid{get;set;}
    public map<Id,String> locmap= new map<Id,String>();
   
    public List<SelectOption> getAvailableLocations() {
        List<SelectOption> Opts = new List<SelectOption>();
        for (Location__c  l : [Select Id, Name From Location__c limit 1000]){
            Opts.add(new SelectOption(l.Id, l.Name));
            locmap.put(l.Id, l.Name);
        }
        return Opts;
    }

    public pagereference showrep(){
        pagereference p = new pagereference('https://ap1.salesforce.com/00O90000007mGeE?pv0='+ locmap.get(locid));
        system.debug('p-----'+p);
        return p;
    }



My page:


<apex:page controller="Newfcntrl" sidebar="false" showHeader="false">
<apex:form id="theForm">
<apex:actionFunction name="testAF" action="{!showrep}" rerender="theForm"/>
Location :<apex:selectList value="{!locid}" multiselect="false" size="1" onChange="testAF();">
            <apex:selectOptions value="{!AvailableLocations}" />
            </apex:selectList>
           <analytics:reportChart reportId="00O90000007mGeE"></analytics:reportChart>
</apex:form>
</apex:page>


Thanks.