I want to delete a attachment through activity. In a flow. When I use delete attachment ootb activity from work-. Based on parameter of skip harness = true. The attachment is deleting but on harnerss I am seeing no steam to display messages. If I keep skip harness = false. The attachment is deleting but in ootb attachments section I am able to see the attachment. If I refresh the section the attachment was removing. There was some gap. Could you help me to understand. Thanks
Deleting attachments
Superman
This seems to be a known issue in Pega when we invoke DeleteAttachment from our custom activity to delete the attachments. But we can make it work with additional handling as mentioned below.
1) With Param.SkipHarness=="false"
- When this param is set to false, the actual expectation is to reload the harness after the successful delete. Harness name to refresh should be passed in Param.Purpose. There is an issue in the DeleteAttachment API wherein step 24, they reset Param.Purpose from Param.HarnessPurpose which is making it blank. Hence we see No Stream to display message in harness.
2) With Param.SkipHarness=="true"
- The attachments section in the work object is sourced from the data page D_AttachmentList. This is a thread-level data page and after the deletion of attachment, this data page is not reloaded. Hence we see all the attachments in the attachment section after delete. Adding a step to flush this data page will reload the data page and fetches the updated attachment list from the database.
Solution:
Do not invoke delete attachments directly in your code, rather create a wrapper activity with the below steps and invoke this to delete the attachments.
Note:
1) Param.HarnessType used in step 1 will be set by default in all scenarios.
2) Place the wrapper activity in the reusable class so that you can invoke this from different classes of your application.
Let us know if the above solution works or get back to us in case of any additional information.