AnsweredAssumed Answered

applyEdits fails in JSAPI

Question asked by epeconsulting on Sep 28, 2015
Latest reply on Oct 1, 2015 by RTreecare

I am using a feature layer in JSAPI, where I edit a feature by the standard selection, change attributes, applyEdits process. It seems that there is a bug in JSAPI both 3.12 and 3.14 which makes the apply edits fail on certain features. The callback just errors out without any clue.

The interesting observations:

1. Failure only happens on certain features and all cases belong to a particular layer (other features in that layer are just fine).

2. Changing from 3.12 to 3.14 the features that cause the error are changed but did not go away.


Here is a quick snippet of the code:

sq = buildSelectionQuery();
if (sq) {
    all( (l) { return l.selectFeatures(sq, esri.layers.FeatureLayer.SELECTION_NEW).promise;})
    ).then(function (fls) {
        console.log('sel res', fls);
        all( (r, i) {
            var fs = r[0]; // the first is an array of selected features
            var l = assetsFeatureLayers[i];
            if (fs.length > 0) {
                console.log("Switching phases to: ", tph);
                fs.forEach(function (f) {
                    f.attributes['phasecode'] = tph;
                console.log("Saving switched phases for layer: ",;
                return l.applyEdits(null, fs, null); //.promise;
            } else {
                return null;
        })).then(function (l) {
            console.log("Phase switching finished successfully!", l);
        }, function (e) {
            console.log("Error switching phases!", e);