Is there a way to take snapshot of a dashboard component and get the url of the image, all via code?

I tried to use ConnectApi.DashboardComponentSnapshot, but i get error saying i can't construct a snapshot outside a test. Here is the code i was trying (i have hardcoded dashboardId, componentId, dashboardName, etc)

ConnectApi.DashboardComponentSnapshot dashboardSnap = new ConnectApi.DashboardComponentSnapshot();
dashboardSnap.componentId = '01a30000003G6qE';
dashboardSnap.componentName = 'Sample Component Name';
dashboardSnap.dashboardId = '01Z30000001HjMK';
dashboardSnap.dashboardName = 'Sample Dashboard Name';

String myURL = String.ValueOf(dashboardSnap.thumbnailUrl);

But above code doesnt really work. Even if i put it in a class and call the method, i still get the same error. Any suggestions?

  • Having the same issue....please update if you found any solution – Nilesh Borse May 10 '18 at 12:15

Your Answer

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

Browse other questions tagged or ask your own question.