Select to view content in your preferred language

addFeature, applyEdits, deleteFeature issue

667
1
09-20-2019 02:42 PM
MarkHolm
New Contributor II

I am having an issue with adding a new feature, applyEdits, then trying to delete the feature right away. It appears that when you add a feature it assigns a negative objectID to that feature, and when you applyEdits it assigns a real unique objectID, so when you use the initial feature object you created, or the one from addedFeatures before applyEdits it errors when you try to delete using that initial feature object. This is the error "Item not found in the database. (Table, domain, relationship class, etc.), addtl: The following features were not found: [-10] (2019-09-20 16:21:26:957). Apparently -10 is the objectID in the local featureTable still even after applyEdits.

What is the correct way to do this?

0 Kudos
1 Reply
LucasDanzinger
Esri Frequent Contributor

Couple of things to try:

1) After you create the Feature and add it to the table, call refresh() on the Feature - Feature QML Type | ArcGIS for Developers 

2) If you want to clear out your edits before you've applied, you could call undoLocalEdits() - ServiceFeatureTable QML Type | ArcGIS for Developers 

0 Kudos