Problem: When you use the C# client API to edit a mobile business object (MBO), then synchronize this update to the server, the update fails at the backend server. Then, if you call the C# client API to delete the MBO, the delete fails.
Example code:
int id = 777; //it's the customer id Customer cust = Customer.FindBy(id); cust.Name = "some other name"; cust.Update(); Customer.Synchronize() //... //you verify operation log that indicates the update failed at backend server //... cust = Customer.FindBy(id); cust.Delete(); Customer.Synchronize(); //... //you verify operation log that indicates the delete failed //...
Solution: Call UndoUpdate() after the failed update operation to delete the MBO.
Example code:
int id = 777; //it's the customer id Customer cust = Customer.FindBy(id); cust.Name = "some other name"; cust.Update(); Customer.Synchronize() //... //you verify operation log that indicates the update failed at backend servercust = Customer.FindBy(id); //... cust = Customer.FindBy(id); cust.UndoUpdate(); cust.Delete(); Customer.Synchronize(); //... //you verify operation log that indicates the delete succeeded //...