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); System.debug(myURL);
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?