on 07-14-2015 10:05 AM
Hi all,
I am facing a problem with editing an offline entity.
Actually I can add the entity to my offline store without any issue. This works more or less like the following lines show.
var request = {
headers : oHeaders,
requestUri : appointmentURL,
method : "POST",
data : oAppointment
};
OData.request(...);
The oAppointment contains just some data like description, account, contact, etc.
Once the appointment is created offline it is accessable via an URI looking like this:
"http://10.157...:8080/appID/AppointmentSet(lodata_sys_eid=X'60994DF02A2511E58000F93EFBE65E2B00000000')"
So after that I try to modify the appointment like this:
var request = {
headers : oHeaders,
requestUri : appointmentURL,
method : "PUT",
data : oAppointment
};
OData.request(...);
Now the Error occurs and just says: "Request failed".
I pretty much think the request fails because of the missing GUID of the appointment entity. But actually the GUID will only be created at the host system. And as long as I am working offline I dont have access to this host system...
Does someone has a workaround?
Thanks a lot for helping!
regards,
Clemens
Hi Clemens,
Are you trying to edit an existing entity in the backend ? Make sure you are passing all the required parameters to do operation.
If you are trying to edit an entity which is not present in backend but present in your offline store might be cause an issue.
Regards,Midhun
SAP Technology RIG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for such a fast reply!
Actually the entity is not present in the backend but only in the offline store.
The intention is that I try to add a appointment when I am offline. But I would like to be able to modify this appointment as long as I am offline.
Later on (when beeing online again) I flush the changes.
regards, Clemens
Hi Clemens,
you could try to perform a batch request on the offline store for the scenario which you have mentioned above.
1.Create an appointment when your are offline and add this request to batch and send this batch request .
2. Read the offline store data to verfiy your request has been created
3. Modify your request ,add this to batch and send this batch request.
4. Later on being online flush your changes.
Hope this helps.
Thanks,
Latha
Hi Latha,
Thanks for your support!
I followed your instruction step by step but unfortunately this didn't work as well. The same error appears: "Request failed".
Just to make sure I understood everything right here is the corresponding code:
Step1 Add:
var params = {
__batchRequests: [ {
__changeRequests: [ {
requestUri: saveAppointmentsURL,
method: "POST",
data : oAppointment
}
]
}
]
};
var request = {
headers : oHeaders,
requestUri : applicationContext.applicationEndpointURL + "/$batch",
method : "POST",
data : params
};
OData.request(...);
Step3 Modify:
var params = {
__batchRequests: [ {
__changeRequests: [ {
requestUri: updateAppointmentsURL,
method: "POST",
data : oAppointment
}
]
}
]
};
var request = {
headers : oHeaders,
requestUri : applicationContext.applicationEndpointURL + "/$batch",
method : "PUT",
data : params
};
OData.request(...);
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.