Showing Layer using subcanvas container/Score card - Resolved

Hi,

I’m attempting to show a layer in a dashboard using an embedded scorecard. My script goes something like this:

var canvasService = this.getService(“CanvasService”);
var DetailsLayer = canvasService.getLayersByFriendlyName(“Ward Overview Details”)[0];
canvasService.showLayers([DetailsLayer])

However it’s not recognizing the layer I’m attempting to use as I suspect my script is referring to my scorecard canvas. Does anyone know how I could specifically state the canvas/dashboard I want to manipulate in my script? Fully qualify the object I want to change?

image

This did the trick:

var CurrentView = dundas.context.baseViewViewService.currentView

var canvasService = CurrentView.getService(“CanvasService”);
var DetailsLayer = canvasService.getLayersByFriendlyName(“Ward Overview Details”)[0];
canvasService.showLayers([DetailsLayer])

2 Likes