AnsweredAssumed Answered

QueryTask Result to a Feature Layer

Question asked by David.Kucharski@23 on Oct 15, 2018
Latest reply on Oct 15, 2018 by David.Kucharski@23

I am trying to use the FeatureSet results, from a QueryTask, as the Source of a Feature Layer. No matter how I am doing it, I cannot seem to get the Feature Layer loaded. Please see my logic below and let me know what I am doing wrong. 


1. var qTask = new QueryTask({
url: zipCodeUrl


2. var params = new Query({
returnGeometry: true,
outFields: ["*"]


3. params.where = "ID_ IN (" + blue.value + ")";



function getBlueResults(response) {

layer = new FeatureLayer({
 source: response.features, // autocast as an array of esri/Graphic
// // create an instance of esri/layers/support/Field for each field object
 fields: bluefields, // This is required when creating a layer from Graphics
 objectIdField: "ObjectID"