AnsweredAssumed Answered

Update feature - applyEdits - Cannot read property 'attributes' of undefined

Question asked by warleymendes@gmail.com on Oct 9, 2018

Hi Guys
I'm trying to make a simple update using applyEdits function as shown in the code below but I'm getting the error "Cannot read property 'attributes' of undefined".

What I'm doing wrong?

 

featureUpdateClandestino: null,

searchById: function(){

   var featLyrClandestino = new esri.layers.FeatureLayer(this.URL_Clandestino_Feature,
      {
         outFields:["*"]
      }
   );

 

   //get object
   var query = new esri.tasks.Query();
   query.where = "OBJECTID = "+ this.objecIdClandestino;

 

   var queryDeferred = featLyrClandestino.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
   queryDeferred.then(lang.hitch(this,
      function (features)
         {
            this.featureUpdateClandestino = features[0];
         }

     ));
},

 

update: function(){
   var featLyrClandestino = new esri.layers.FeatureLayer(this.URL_Clandestino_Feature);

   //change attribute value
   this.featureUpdateClandestino.attributes.ECONOMIAS = 100;

 

   //Update
   var applyDeferred = featLyrClandestino.applyEdits(null, [this.featureUpdateClandestino], null);
   applyDeferred.then(lang.hitch(this,
      function (result) {
         console.log("Updated....");
      }
   ),lang.hitch(this, function(err) {
      console.error("Error: ", err.message);
   }));
}

 

 

 

Thanks,

Warley Rocha Mendes

Outcomes