on 12-10-2018 9:08 PM
I am currently attempting to implement downloading of offline attachments with my app.
I have configured a defining request pointing to my attachments entity with retrieveStreams = true
"Attachments" : {"url" : "/zdod_i_attachments", "retrieveStreams" : "true"}
However, on initial opening of the store I receive a sync error. Checking mobile services, I can see that the app attempted to call:
<service_root> + <service_name>/<file_name>
The app appears to be attempting to download all attachments on store open. I assume I need to use the function registerStreamRequest, however I am unsure where in the application lifecycle this needs to be called and if I need to make the function call for each individual attachment
Below is a sample call:
sap.hybrid.store.registerStreamRequest("stream",
"/zdod_i_attachments(incidentId=guid'" + "c4113ba7-6c91-4e6e-a816-d033e54bfcc" + "',attachmentId=guid'" + "061836cc-5e27-1ed8-beb9-30c5092e42c6" + "')",
sap.hybrid.onRegisterStreamSuccess, sap.hybrid.onRegisterStreamError);
Then in the success callback I trigger a refresh:
onRegisterStreamSuccess : function(){
sap.hybrid.store.refresh();
},
How can I make sure the store attempts to call the right path pointing to the attachment entity?
Thanks,
William
Hi,
I can see multiple questions here:
1) Do I need to register/unregister for each attachment?
Unfortunately, yes. This impacts the answer to 2)
2) When to call the download of an attachment?
Whenever you need to get it, it's up to you to decide.
Does the .refresh() works for you and you can download and refresh the attachment?
Note (it's boolean not string):
"retrieveStreams" : true
Related documentation can be found here (for other readers, you already found it)
Hope this helps a bit.
Regards,
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
73 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
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.