2

Is there a way I can initiate a dashboard refresh from a VF page remotely?

Is there an action or a URL I can use to refresh a specified dashboard?

I want to recreate the refresh dashboard button on my VF page. I have seen the schedule refresh option but I am looking for more control for the user to refresh the dashboard on demand.

4

Salesforce allows you to do this through the Reports and Dashboards REST API

If you make an http PUT request to: BaseURL/services/data/v31.0/analytics/dashboards/DashboardID and set the session id in the request header, it will refresh the dashboard for you.

In a Visualforce page, you could add a method to your controller similar to the following:

public void refreshDashboard(){
    HttpRequest req = new HttpRequest();
    req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
    req.setMethod('PUT');
    req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm() + '/services/data/v35.0/analytics/dashboards/01Z90000000A7Nx');

    Http http = new Http();
    HttpResponse res = http.send(req);
}
-1

You can't through salesforce or a url param, but you could make a quick java(or language of choice) program to login and do it with a library like phantomjs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy