AnsweredAssumed Answered

Delete Newly Created Feature

Question asked by chad.yoder@nwg on Feb 15, 2017
Latest reply on Feb 23, 2017 by chad.yoder@nwg

I'm experiencing an issue trying to delete a feature which was just created.  This is all while working online using iOS (haven't tested yet on Android or UWP).

 

The scenario is this:

 

  • User is viewing a list of maintenance records and wants to add a new one.  We transition to a new page to allow the user to add the new record, click save and the feature is created and added to the model which is bound to the previous page.
  • User returns to the previous page and sees the new record, but then decides they'd rather not add, so they select the record and attempt to delete it.
  • I've tried 3 ways to get this to work, but none have worked.  It seems like the feature is "stuck" as the local copy, not the actual feature that was added to the server.
  • Feature.RetryLoadAsync() does nothing to change this behavior.

 

  1. Using FeatureTable.DeleteAsync() throws an error:  "Unable to complete operation".
  2. Next thought was to use the ObjectId and query to find the feature.  Well, this is a negative number (which makes sense, but I'm online, so why isn't it the real one?)
  3. Next try the GlobalId.  Well...the GlobalId is created when CreateFeature() is called.  But, if you use this to query to find the record on the server so you can delete it, it won't find it, because the server record has a new GlobalId.

 

If I query the table to get all of the records again, I can then find the one I want using other attributes and delete it, but this only works after using another query.  Any way around this?  Should RetryLoadAsync() rehydrate the feature as it is on the server?  Seems like there needs to be a way to get the server feature after it is created, but I don't see any way to do that.

 

Any ideas or thoughts would be appreciated.

Outcomes