LegendLayer.layerId setup for Tax Parcel Viewer web application template

Discussion created by lbrannon on Jan 7, 2014
Has anyone out there successfully customized the legend in the print widget of the Tax Parcel Viewer web map template so that the print legend displays some of the map viewer layers but not all of them?

My ArcGIS Resources research thus far indicates that a layer "id" must be setup for each operational layer on the map, in this fashion: "id": "PoolPermits", to be able to use the LegendLayer class to choose specific layers for the legend. But with the web application template pulling in dynamic map services in its unconventional way from the ArcGIS Online map viewer, I have not been able to figure out how to setup the required layer "id".  I am hoping someone out there has done this and can give me some advice on the coding of it.

Below is sample code (not mine) of what I am trying to get implemented.

var legendLayer = new esri.tasks.LegendLayer();
legendLayer.layerId = "PoolPermits";
legendLayer.subLayerIds = [0, 1];

printParams.template.layoutOptions = {
    titleText: pThis.titleEntryTextBox.value,
    authorText: pThis.authorEntryTextBox.value,
    copyrightText: pThis.copyrightText,
    scalebarUnit: pThis.scalebarUnit,
    legendLayers: pThis.legendLayer