I was using JS 3.x to add and update data. I am working on convert my applications to JS 4.x. I had a script that used "dojo/Deferred". Here is the code:
function _applyAdds (featureLayer, propertiesArr)
{
var defer;
require (['esri/graphic', "dojo/Deferred"], function (Graphic, Deferred)
{
defer = new Deferred ();
var graphicsArr = [];
propertiesArr.forEach (function (properties)
{
graphicsArr.push (new Graphic (null, null, properties));
});
featureLayer.applyEdits (
graphicsArr, null, null,
function (a, u, d)
{
console.log (a, u, d);
defer.resolve ();
}, // callback
function (error)
{
console.log ('ERROR!', error);
}// errorback
);
});
return defer.promise;
}
//begin adding new employee assignment
function assignEmployee ()
{
var addEmployee = {};
addEmployee.SPACEKEY = document.getElementById ('EmployeeSpaceID').value;
addEmployee.EMPLOYEEKEY = document.getElementById ('EmployeeID').value;
console.log (addEmployee);
_applyAdds (roomAssinmentTable, [addEmployee]).then (function ()
{
console.log ("Add Employee");
});
}
How do i make this work in JS 4.x?
Thank you in advance for any help on this.
Solved! Go to Solution.
I am looking at the Server logs and see these rrors now:
Error performing apply edits operation Error handling service request :Could not service request.
Instance of the service 'REO/REV_UWOPS_EditLayers.MapServer' crashed. Please see if an error report was generated in 'D:\arcgisserver\logs\uwopapp.uwyo.edu\errorreports'. To send an error report to Esri, compose an e-mail to ArcGISErrorReport@esri.com and attach the error report file.
Joel,
I am not seeing the "payload" tab.
If you double-click on a request in the Network log, you'll see an additional set of tabs with information about the request...the Payload tab is in there.
Thanks i see the Payload for the request above the applyEdits (query). When i click on the request for applyEdits that goes away.
very strange it works for a single row using the original fucntion. I cannot get the new fucntion from above to just do a single row or single OBJECTID.
Maybe if you can post a screenshot of the payload tab for a request that works (single) and a request that fails (multiple) it might help reveal if the problem is on the application side.
here is a screenshot
That shows the request for the query option that preceded applyEdits, but I would need to see the details for the applyEdits request. That is, you'd need to double click the row for applyEdits.
Joel,
Here is what it looks like when i double click the row on the applyEdits
Ok, since there's no payload tab, I see what you were saying earlier about the tab going away. Unfortunately, without it, it doesn't give us much to go on. It makes me wonder if the request is being sent without the features being edited because if I understand it correctly, the Payload tab should still be there even if a POST request results in an HTTP 500. This one may need Esri Technical Support if you have access to it.
I am wondering if it may be that the database isnt upgraded to 11.x and is stil 10.8? I am going to test it out on a tests database.