Question
Download ALL Attachments functionality
Hi All,
We have a requirement to download all attachments of a workobject with the one click of a button.
I have added a custom coding where , I'm browsing the pc_link_attachment table for the pxLinkedRefFrom value for the particular work objects and is calling the activity Work-.DisplayAttachFile on a loop of the above result count, and passing the value of pxLinkedRefFrom everytime.
In tracer I have observed although the DisplayAttachFile is getting called multiple times with correct parameter each time but on the user browser everytime the last attachment in the list is getting downloaded and NOT ALL.
Do anyone have any advise where I'm missing?
This approach of triggering multiple downloads from the server-side won't work unfortunately : the last download will always take precedence (as you have found).
This is more to do with how HTTP works; rather than being a specific PRPC thing : see here for instance : http://stackoverflow.com/questions/2339440/download-multiple-files-with-a-single-action
Consider zipping up all the attachments into a single file and then triggering the download for that.
This post may help here: it shows you have to do the first bit (zip up all the attachments) - you would need to add to this solution to trigger the download (that should be the easier bit to achieve though probably).
https://pdn.pega.com/community/pega-product-support/question/how-create-zip-archive-and-attach-case