Support Article
Attachments not deleted in mobile offline application
SA-84772
Summary
In a mobile offline application, when removing work objects from a mobile device after submitting and synchronizing an assignment, the work objects are removed from the device. However, all the attachments related to these work objects are not removed from the device.
The below script is used to confirm if the file exists on the device:
launchbox.PRPC.ClientStore.getItem("DATA-WORKATTACH-FILE","DATA-WORKATTACH-FILE RR-MOBILETEST-WORK O-89!20190705T085058.427 GMT").then (item => {console.log(item.url); launchbox.DocumentViewer.open(item.url,{},handlers)}) and image was successfully opened.
The user has Pega 7.4 with Hybrid Client (HC) 7.41.3.1 without any custom code.
Error Messages
Not Applicable
Steps to Reproduce
- Define a sample offline case type.
- Add a button to the section and change the control type to 'Attach content'.
- In the Control properties, change Category to 'File'.
- Build an Android or iOS application (Android for this use case). The device is connected to the Internet..
- Create a new case.
- Click the Attachment button created. Click a photo and attach it to the case. Note the case ID.
- Submit the case.
- In Chrome DevTools, list all items with API:
launchbox.PRPC.ClientStore.getItemsStats(function(x) {console.log("elo1: " + JSON.stringify(x));}, function(x) {console.log("elo2: " + JSON.stringify(x));});
- In the output, locate the attachment item using the case ID.
In this use case: {"type":"DATA-WORKATTACH-FILE","handle":"DATA-WORKATTACH-FILE O77V2G-HARNESS-WORK H-25!20190705T124026.079 GMT","size":null},
- Define the handlers using the information provided in: http://docbuild.antennasoftware.com/docs/archives/ac/ac_7_41_0/client_api/container_example_doc_viewer.html
var handlers = {
onProgress: function (progress) {
console.log('Progress: ' + progress * 100);
},
onSuccess: function () {
console.log('SUCCESS!');
},
onFailure: function (error) {
console.log('FAILURE! ' + error.description + ' code: ' + error.code);
}
};
- Invoke the below getItem API:
launchbox.PRPC.ClientStore.getItem("DATA-WORKATTACH-FILE", "DATA-WORKATTACH-FILE O77V2G-HARNESS-WORK H-25!20190705T124026.079 GMT").then(item => {console.log(item.url); launchbox.DocumentViewer.open(item.url,{},handlers)})
Reported behavior: The below is printed and the image displays on the device screen,
filebox://fs_com.pega.gcs.pushtest/shared_temporary/ClientStore/files/4aqYgZ0fhJEhSyvU4eTD8Ph4tmyNgCw8.jpg
Expected behavior: The attachment should be removed from the device after the case is submitted.
Root Cause
A defect in Pegasystems’ code or rules.
Resolution
Apply HFix-54781.
Published December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.