Question
Export work item attachments to a directory
We have a requirement to export work item attachments to a server location.
Here is what we have done
1. Browse through link-attachment instances get pxLinkedRefTo for each instance.
2. Pass the pxLinkedRefTo as parameter to Obj-Open-By-Handle
3. Decode pyAttachStream using Base64Decode function and set it to a property.
4. Call connect-file with write from clipboard property
Issue: the text files are exported and could read them but couldn't read excel or word files or Images, I have tried by changing the file extensions as well.
Please assist us decoding and exporting these attachments.
Attached the activity written for the same. Any help is much appreciated.
***Edited by Moderator: Lochan to update platform capability tags***
What type is the '.Temp' Property in your Activity?
I see you are using the OOTB function @Default.Base64Decode on the original (base64/text) data held in the 'pyAttachStream'.
Personally: I have never got that function to work in this way; it returns a String from a String (right?).
I have tended instead to use a Java Step to hold the resultant decoded b64 data in a Java Array.
I'm not saying my approach is 'more correct' - its just that I happened to get it working that way.
Take a look at this Post:
https://community1.pega.com/community/product-support/question/zip-binary-file-and-word-file-and-downloading-zipped-file
And in particular the Java Steps in there; you should be able to re-arrange this to suit your needs.
Can you give this a go and see whether you can get it working?
If you can't get it working - please post up your Activity you tried (include Steps, Pages and Params tabs) - and expand any steps.
(For Java Steps; just copy the Java inline - easier to see).
Thanks
John