AnsweredAssumed Answered

applyEdits for updating data (JS4.4)

Question asked by mshukun1 on Sep 11, 2017
Latest reply on Sep 11, 2017 by rscheitlin

I am having a problem updating a feature layer data using applyEdits function.  I looked at the sample code in applyEdits API reference and Sandbox sample code, but I haven't been able to figure it out how to update the data.  I am only interested in updating existing data attributes.  I would very much appreciate your help.  


  function (
    Map, SceneView, FeatureLayer, Extent, ScreenPoint, lang, on, dom
  ) {
    var lyrUrl = '';

    var map = new Map({
      basemap: 'satellite'

    var initialExtent = new Extent({
      xmin: -8520399.50094139,
      xmax: -8466523.75224205,
      ymin: 4109431.55147233,
      ymax: 4173688.01969221,
      spatialReference: 102100

    var featureLyr = new FeatureLayer({
      url: lyrUrl

    var sceneView = new SceneView({
      container: 'map',
      map: map,
      extent: initialExtent

    var _onclick = function (evt) {
      var s = new ScreenPoint({
        x: evt.x,
        y: evt.y

    // Updating feature layer data 
    sceneView.hitTest(s).then(picked => {
      if (picked.results[0].graphic) {
        var editFeature = picked.results[0].graphic;
        editFeature.attributes.YearBuilt = '2000';
        console.log('after edit', editFeature);
        var edit = {
          updateFeatures: [editFeature]
        var promise = featureLyr.applyEdits(edit);
  sceneView.on('click', _onclick);