AnsweredAssumed Answered

Why doesn't applyEdits work after changing to AMD model from Legacy model

Question asked by tgroussell on Sep 18, 2013
Latest reply on Sep 18, 2013 by tgroussell
I am trying to convert code to the AMD model and in the following code the ApplyEdits method stops without generating any error message.
When I step through the code in the debugger, the line "var layer = updateFeature.getLayer();" functions properly but the line "if (originalFeature != null) never executes and no error message is generated.

                dojo.connect(saveButton, "onClick", function () {
                    check_attributes(updateFeature);
                    var today = new Date();
                    var dd = today.getDate();
                    var mm = today.getMonth() + 1;
                    var yyyy = today.getFullYear();
                    var today = String(yyyy) + '/' + String(mm) + '/' + String(dd);
                    updateFeature.attributes.Last_Modified_Date = today;
                    user_name = dom.byId("User_Name").innerHTML;
                    updateFeature.attributes.Last_Modified_By = user_name;

                    var layer = updateFeature.getLayer();

                    try {
                        layer.applyEdits(null, [updateFeature, ], null, function () {
                            if (originalFeature != null) {
                                try {
                                    var operation = new editingUpdate({
                                        featureLayer: layer,
                                        preUpdatedGraphics: [new Graphic(originalFeature)],
                                        postUpdatedGraphics: [updateFeature, ]
                                    });
                                    undoManager.add(operation);
                                    checkUI();
                                }
                                catch (err) {
                                    alert(err);
                                }
                            }
                        },
                        function (err) {
                            alert(err.message);
                        });
                    }
                    catch (err) {
                        alert(err.message);
                    }
                });

Outcomes