on ‎2018 Apr 28 8:10 AM
Hello Experts,
We are working on Offline Application for Android Platform. When we are updating any existing record in offline store that time we are getting
Error:value":"[-10128] The request on an entity failed because its etag did not match the request's conditions.
We are using below code for updating the record in offline
sap.OData.applyHttpClient();
oModel.update("MobCodeSet(OrderNo='5183819')", postEntry, null,
function(){
console.log(success);
}, function(error) {
console.log(error);
}, true);
Please find the attached screenshot for error.
Can you please suggest where we are going wrong.
Regards,
Ashish
Request clarification before answering.
Hello, I solved the problem this way. According to the documentation I found in this link,
It says that we must send the same eTag to the entity to be able to update.

Then... I did a read before updating and copy etag property from metadata of old record.
this.oModel = this.getView().getModel();
var that = this;
that.oModel.read(vPathCero, {
success: function (oData, response) {
that.oModel.update(vPathCero, myEntity, {
success: function (oData, response) {
// your code on success update
},
error: function (oError) {
// your code on error update
},
//////////////////////////////////////////////////////////
"eTag": oData.__metadata.etag
//////////////////////////////////////////////////////////
});
},
error: function (oError) {
// your code on error read
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 7 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.