Working with 4.23 - I am currently using a copy of the "Update FeatureLayer using applyEdits()" sample but I am running into an issue where every time I click the "Update" button after creating a point I receive an error message (below) in the console.log
Uncaught (in promise)
l {name: 'feature-layer:unsupported-operation', details: undefined, message: 'Layer does not support updating features.'}
details: undefined
message: "Layer does not support updating features."
name: "feature-layer:unsupported-operation"
[[Prototype]]: c
The graphic point is created just fine but none of the information I type into the feature form is saved. Also, if I click on an existing point and try to update those attributes nothing works. The only attributes that are saved are the ones that I have set in the graphics layer when the point is initially created.
// Create a new feature using one of the selected template items.
editFeature = new Graphic({
geometry: point,
attributes: {
KINGDOM: attributes.KINGDOM,
ADD_DATE: Date.now(),
LATITUDE: event.mapPoint.latitude,
LONGITUDE: event.mapPoint.longitude,
LATDIR: "NORTH",
LONDIR: "WEST"
}
});
My hosted feature layer has Add, Updated and Delete all selected.
I have not made any changes to the sample code so I am not quite how to get this to work the way I need it to.
Solved! Go to Solution.
I am not sure this would really work in this situation. The fields that I am trying to populate with the applyedits and with the query are not shown to the user nor will they be editable by the user.
Has anyone else encountered this issue?
I am using the code exactly as is from: https://developers.arcgis.com/javascript/latest/sample-code/editing-applyedits/
Below is my JSON from the hosted feature layer that contains all 4 editable layers.
"capabilities" : "Create,Delete,Query,Update,Editing,Sync",
"syncCapabilities" : {
"supportsAsync" : true,
"supportsRegisteringExistingData" : true,
"supportsSyncDirectionControl" : true,
"supportsPerLayerSync" : true,
"supportsPerReplicaSync" : true,
"supportsSyncModelNone" : true,
"supportsRollbackOnFailure" : true,
"supportsAttachmentsSyncDirection" : true,
"supportsBiDirectionalSyncForServer" : true,
"supportedSyncDataOptions" : 4
},
"supportsApplyEditsWithGlobalIds" : true,
"supportsReturnDeleteResults" : true,
"supportsLayerOverrides" : true,
"supportsTilesAndBasicQueriesMode" : true,
"supportsQueryContingentValues" : true,
"supportedContingentValuesFormats" : "JSON, PBF",
"supportsContingentValuesJson" : 2,
"advancedEditingCapabilities" : {
"supportsSplit" : false,
"supportsReturnServiceEditsInSourceSR" : false,
"supportsAsyncApplyEdits" : true,
"supportsReturnEditResults" : true
The point is created, I am able to see the fields and edit them but as soon as I click the "Update Incident" button in this example I receive an error in the console.log and nothing happens on screen. The point shows up in the layer but only the attributes I pass with the graphic is included, none of the attributes that the user can modify get saved.
Hi,
When you click the "Update Incidents" button, what is the response from the applyEdits request?
Here is an example of a failed request. In this case the error description is pretty helpful. Although, it sounds like applyEdits is succeeding, if the point is being added to the layer.
Can you also check the request parameters to confirm that all of the user submitted attributes are making it into the payload?
I get no response when I click on the "Update Incidents" button. All I get is an error in the console log
Yes, it seems like the add is working just fine but the update isn't. In reality, it shouldn't be submitting the point until all the information in the form is filled out. So the only information being saved with the record is the attributes here:
// Create a new feature using one of the selected
// template items.
editFeature = new Graphic({
geometry: point,
attributes: {
KINGDOM: attributes.KINGDOM,
LATITUDE: event.mapPoint.latitude,
LONGITUDE: event.mapPoint.longitude
}
});
I also get a similar error message in the console.log if I try to delete a record even though Add, Update and Delete options are enabled in the layer settings.
@JillianStanford - I was finally able to get the a test update to work via the REST API. So updates should work but I am unsure what in my code is preventing the updates. Do I need to add an API key to this?
I ended up opening an ESRI ticket for this issue. As it turns out, all the settings were correct and somehow the hosted feature service must have gotten corrupted. After republishing, everything works as it should.