Update FeatureLayer using applyEdits() sample error

2407
15
Jump to solution
05-17-2022 07:08 AM
luckachi
Occasional Contributor III

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.

 

0 Kudos
1 Solution

Accepted Solutions
luckachi
Occasional Contributor III

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.

View solution in original post

15 Replies
JillianStanford
Occasional Contributor III

Hi,

Are you able to edit the service using a different client, like the REST endpoint or ArcGIS Pro?

0 Kudos
luckachi
Occasional Contributor III

I am able to add/update/delete through ArcGIS Pro. I can add via the REST endpoint. Testing Update and Delete right now

0 Kudos
luckachi
Occasional Contributor III

Update I receive an error (not sure if I am doing this wrong - not very knowledgeable with REST

"attributes" : {
"OBJECTID" : 139,
"OBSERVER" : "Claire"
}

{
  "error" : 
  {
    "code" : 400, 
    "message" : "Cannot perform operation. Invalid operation parameters.", 
    "details" : [
      "'updates' parameter is invalid", 
      "Invalid JSON primitive:  {   \"OBJECTID\" : 139,   \"OBSERVER\" : \"Claire Peterson\" }."
    ]
  }
}

When I try to delete a record I was able to add, I get an error message. 

deletes=140

{
  "error" : 
  {
    "code" : 400, 
    "message" : "Cannot perform operation. Invalid operation parameters.", 
    "details" : [
      "'deletes' parameter is invalid", 
      "Input string was not in a correct format."
    ]
  }
}
0 Kudos
JillianStanford
Occasional Contributor III

Can you post the entire chunk of code for making your edits?

I am able to successfully update and delete a record using the following payloads.

JillianStanford_0-1652801575647.png

JillianStanford_1-1652801800646.png

 

0 Kudos
luckachi
Occasional Contributor III

For the testing or in my actual javascript file? 

0 Kudos
ReneRubalcava
Frequent Contributor

That error you're getting means the layer doesn't support editing, but could you try using your layer in this simple sample and see if you can edit the features

https://codepen.io/odoe/pen/dydvvaB?editors=1000

Try to edit, add, delete, and see if it works there.

0 Kudos
luckachi
Occasional Contributor III

I am able to add just fine but when I click on Select under Edit Features, I am unable to make a selection.

These are my settings on the hosted feature layer which contains 4 separate layers.

luckachi_0-1652806259663.png

 

0 Kudos
luckachi
Occasional Contributor III

And this may not even be easiest way to go about this but my main goal is when people create a feature, I would like certain attributes in the Feature Form or Editor to be already filled in - the ones that I have populated in my Graphic Layer in the initial post. 

Then when they select a species from a drop down, I have a query going off to grab the matching attribute information from a table and I would like to bring back the Genus and Species attributes from that table and have those values populate the associated boxes in the form.

0 Kudos
JillianStanford
Occasional Contributor III

Instead of querying for related attributes have you looked into setting up contingent values? - https://www.esri.com/arcgis-blog/products/js-api-arcgis/developers/contingent-attribute-values-in-th...

0 Kudos