Select to view content in your preferred language

Pass a Graphic into ApplyEdits stops working with 4.18

395
0
02-08-2021 08:59 AM
PHerk
by
Emerging Contributor

Used to pass a graphic into Applyedits to update an Attribute.

The code below works with API version 4.16, but fails in 4.18.

In 4.18 I have to query for the feature and than pass it into my updatefeature function.

Is this an error or did I miss a change in 4.17 or 4.18 API?

function updatefeature(graphic, layer) {
graphic.attributes.Status = "1";
const edits = { updateFeatures: [graphic] };
applyEdits(edits,layer);
}

    function applyEdits(params,layer) {
      layer
        .applyEdits(params)
        .then(function(editsResult) {
        if (
          editsResult.addFeatureResults.length > 0 ||
          editsResult.updateFeatureResults.length > 0
        ) {
          let objectId;
          objectId = editsResult.addFeatureResults[0].objectId;
        else if (editsResult.deleteFeatureResults.length > 0) {
        }
      })
        .catch(function(error) {
        errormessage("ArcGIS applyEdits error", error.code + ' | ' + error.name + ' | ' + error.message);
      });
    }
 
Thanks
0 Kudos
0 Replies