Mark,
So where is your topic subscribe to the "toggleChanged" in the above code?..
_publishMapEvent: function(map) {
topic.subscribe('toggleChanged', lang.hitch(this, function(visible, layer){
if(visible){
this.SERVICE_ID = layer.id;
}
}));
window._viewerMap = map;
MapUrlParamsHandler.postProcessUrlParams(this.urlParams, map);
console.timeEnd('Load Map');
if (this.map) {
this.map = map;
this.resetInfoWindow(true);
console.log('map changed.');
topic.publish('mapChanged', this.map, this.layerInfosObj);
} else {
this.map = map;
this.resetInfoWindow(true);
topic.publish('mapLoaded', this.map, this.layerInfosObj);
}
require([
'esri/graphic',
'esri/symbols/SimpleMarkerSymbol',
'esri/symbols/SimpleLineSymbol',
'esri/Color'
], lang.hitch(this, function(Graphic, SimpleMarkerSymbol, SimpleLineSymbol, Color){
var symbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE,
12,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_NULL,
new Color([247, 34, 101, 0.9]),
1
),
new Color([207, 34, 171, 0.5])
);
map.on("click", lang.hitch(this, function(evt){
map.graphics.clear();
map.graphics.add(new Graphic(evt.mapPoint, symbol));
map.infoWindow.setContent('<a href="https://survey123.arcgis.com/share/' + this.SERVICE_ID + '?center='+evt.mapPoint.getLatitude().toString() +","+ evt.mapPoint.getLongitude().toString()+'" target="_blank"><font size="4">Click here to submit a service request</font></a>');
map.infoWindow.show(evt.mapPoint)
}));
}));
},