Discussion
Standard Chartered Bank
Standard Chartered Bank
IN
Standard Chartered Bank
Posted: Mar 1, 2016
Last activity: Mar 16, 2016
Last activity: 16 Mar 2016 19:14 EDT
Closed
How to get Attachment Data from a work object in Binary format
Hi,
I have a business requirement where i need to get attachment data from work object in binary format, How to retrieve the data from database either by Obj-Browse or any other way?
Thanks in Advance :)
What type of attachment? Do a search for: All Content contains: sendFile
If you have a "File" attachment, the base64-encoded content is stored in ".pyAttachStream" whereas for Rule-File-Binary (R-F-B) attachments, the base64-encoded content is found in ".pyFileSource".
For the latter, i.e., R-F-Bs, take a look at Rule-File-Binary downloadFile Activity
For the former, i.e., Data-WorkAttach-File instances, see the Work-.DisplayAttachFile Activity.
You may also want to look at the Default • Base64Decode Function but you need to be careful as the Function says it returns a String which is not compatible with binary data due to character encoding.
Use alternative Base64Util methods that return either a byte[] array or an InputStream.
In particular consider using the byte[] array version of tools.sendFile() if using the Base64Decode.decode() Function.
EX: tools.sendFile( myByteArray, myFileName, false, null, true);
///////////////////////
What type of attachment? Do a search for: All Content contains: sendFile
If you have a "File" attachment, the base64-encoded content is stored in ".pyAttachStream" whereas for Rule-File-Binary (R-F-B) attachments, the base64-encoded content is found in ".pyFileSource".
For the latter, i.e., R-F-Bs, take a look at Rule-File-Binary downloadFile Activity
For the former, i.e., Data-WorkAttach-File instances, see the Work-.DisplayAttachFile Activity.
You may also want to look at the Default • Base64Decode Function but you need to be careful as the Function says it returns a String which is not compatible with binary data due to character encoding.
Use alternative Base64Util methods that return either a byte[] array or an InputStream.
In particular consider using the byte[] array version of tools.sendFile() if using the Base64Decode.decode() Function.
EX: tools.sendFile( myByteArray, myFileName, false, null, true);
///////////////////////
com.pega.pegarules.pub.uti
Class Base64Util
java.lang.Object
com.pega.pegarules.pub.util.Base64Util