AnsweredAssumed Answered

JS API 4.16 Coded Domain Values with QueryTask

Question asked by luckachi on Aug 18, 2020
Latest reply on Aug 25, 2020 by ajbooter

There are a lot of threads that talk about returning the coded domain values descriptions while using a queryTask but from the few examples I have seen using the 4.x API, I can't get anything to work. My code is below if anyone could help me. I haven't really found any examples along the same lines as to what I am trying to do.


//build query task
    var queryTask = new QueryTask({
      url: ""

    //build query filter
    var query = new Query();
    query.returnGeometry = true;
    query.outSpatialReference = view.spatialReference; //added for testing
    query.outFields = ["*"];

    //pass the url parameters.
    var urlObject = urlUtils.urlToObject(window.location.href);
    if (urlObject.query)
      if (
      { OID =; }

    //set query based on the parameters

    var treatmentid = "OBJECTID = '" + OID + "'";
    query.where = treatmentid;

  // execute query, place graphic on map and zoom to graphic

         var resultFeatures = result.features;{
           gra.symbol = sym;
           gra.popupTemplate = popupTemplate;

           // Provide graphic to a new instance of a Feature widget
         const feature = new Feature({
           container: "attributes",
           graphic: gra,
           spatialReference: view.spatialReference

         var AOI = result.features;