Find your content:

Search form

You are here

Public Site is not displaying dashboard

 
Share

I displayed visualforce page as public site. But as soon as I added a dashboard onto the visualforce page using the following code....

APEX

    public String getDashboardHtml(){
    PageReference dbPage = new      
    PageReference('https://na15.salesforce.com/01Zi00000006AEr');
    Blob pageBlob = dbPage.getContent();
    return pageBlob.toString();
}

VF

 <script>
  document.getElementById('mainArea').innerHTML = '{!dashboardHtml}';
 </script>

...I get Authorization Required You must first log in or register before accessing this page. If you have forgotten your password, click Forgot Password to reset it

But If I delete the script from vf then everything is ok.

I have the correct settings to expose all the desired custom objects. How do I expose the dashboard?

Please guide.

Thanks


Attribution to: MnZ

Possible Suggestion/Solution #1

Dashboards must be viewed through authentication. Public site do not have authentication and so will not be able to access dashboard.

Here is workaround you can try: you could make a site that logs in, uses the metadata API to get the dashboard data, and then caches it. This site would then not require authentication. However, you will need lot of coding.


Attribution to: AtulRajguru9
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/34896

My Block Status

My Block Content