Solved! Go to Solution.
 function mapReady(map) {
          dojo.connect(map, "onClick", executeIdentifyTask);
          //create identify tasks and setup parameters 
          identifyTask = new esri.tasks.IdentifyTask("http://maps101.gis.halff.com/ladon/rest/services/Lubbock/LubbockCCTVAssets/MapServer/");
          identifyParams = new esri.tasks.IdentifyParameters();
          identifyParams.tolerance = 3;
          identifyParams.returnGeometry = true;
          identifyParams.layerIds = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17];
          identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
          identifyParams.width = map.width;
          identifyParams.height = map.height;
      }
      function executeIdentifyTask(evt) {
          identifyParams.geometry = evt.mapPoint;
          identifyParams.mapExtent = map.extent;
          var deferred = identifyTask.execute(identifyParams);
          deferred.addCallback(function (response) {
              // response is an array of identify result objects    
              // Let's return an array of features.
              return dojo.map(response, function (result) {
                  var feature = result.feature;
                  feature.attributes.layerName = result.layerName;
                  if (result.layerName === 'Survey Points') {
                      console.log(feature.attributes.OBJECTID);
                      var template = new esri.InfoTemplate("Survey Points", "<br/> Unique ID: ${UNIQUE_ID}<br/> X Coord: ${X_COORD}<br/> Y Coord: ${Y_COORD}<br/> Z Coord: ${Z_COORD}<br/> Type:${Type}<br/> Status: ${Status}<br/> Data Source: ${DATA_SOURCE}<br/> Shape: ${SHAPE}<br/> Survey Date: ${SURVEY_DATE}<br/>Alternate Name: ${ALT_NAME}");
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'CCTV Observations') {
                      var template = new esri.InfoTemplate("CCTV Observations", "<br/> CCTV Route: ${CCTV_ROUTE}<br/> CCTV Distance: ${CCTV_DISTANCE}<br/> CCTV Code: ${CCTV_CODE}<br/> CCTV Value Percent: ${CCTV_VALUE_PERCENT}<br/> CCTV Clock From: ${CCTV_CLOCK_FROM}<br/> CCTV Clock To: ${CCTV_CLOCK_TO}<br/> CCTV Grade: ${CCTV_GRADE} <br/>CCTV Continuous: ${CCTV_CONTINUOUS}<br/> CCTV Observation Type:${CCTV_OBS_TYPE}<br/> CCTV Observation:${CCTV_OBSERVATION}<br/> CCTV Remark:${CCTV_REMARK} <br/>Shape:${SHAPE}<br/> CCTV Attachment:${CCTV_Attach}");
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Manholes') {
                      var template = new esri.InfoTemplate("Manholes", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Inlets') {
                      var template = new esri.InfoTemplate("Inlets", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Infalls') {
                      var template = new esri.InfoTemplate("Infalls", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Outfalls') {
                      var template = new esri.InfoTemplate("Outfalls", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Channel Features') {
                      var template = new esri.InfoTemplate("Channel Features", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Pipe Features') {
                      var template = new esri.InfoTemplate("Pipe Features", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Playa Centroids') {
                      var template = new esri.InfoTemplate("Playa Centroids", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Pipes') {
                      var template = new esri.InfoTemplate("Pipes", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Flumes') {
                      var template = new esri.InfoTemplate("Flumes", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Dams') {
                      var template = new esri.InfoTemplate("Dams", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Channels') {
                      var template = new esri.InfoTemplate("Channels", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'CCTV Routes') {
                      var template = new esri.InfoTemplate("CCTV Routes", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Virtual Links') {
                      var template = new esri.InfoTemplate("Virtual Links", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Stormwater Systems') {
                      var template = new esri.InfoTemplate("Stormwater Systems", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Asset Footprints') {
                      var template = new esri.InfoTemplate("Asset Footprints", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  else if (result.layerName === 'Playa Lakes') {
                      var template = new esri.InfoTemplate("Playa Lakes", "${*}")
                      feature.setInfoTemplate(template);
                  }
                  map.infoWindow.setFeatures([deferred]);
                  map.infoWindow.show(evt.mapPoint);
                  return feature;
              });
          });
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
      function executeIdentifyTask(evt) {
          identifyParams.geometry = evt.mapPoint;
          identifyParams.mapExtent = map.extent;
          identifyParams.layerIds = lubbock.visibleLayers;
          var deferred = identifyTask.execute(identifyParams);
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
var visLayers = layer.visibleLayers;
 if (visLayers !== -1) {
 identifyParams.layerIds = layer.visibleLayers;
 }
