Thank you for supporting the Cloud Customer Connect Community in 2024. It's a gift to work with you!

Look back
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Issue trying to read attachment in Groovy scripting

in Sales 5 comments

Summary:

We are trying to read the contents of an activity attachment and upload to an external web service in Groovy scripting.

We are having issues with taking the FileContents BlobDomain and converting to a Byte Array so that we can encode to base64 string.

Code Snippet (add any code snippets that support your topic, if applicable):

 def atts = [];

 def att = Attachments;

 att.reset();

 while (att.hasNext()) {  

   def curAtt = att.next();     

   def outStream = curAtt.FileContents.getBinaryOutputStream();

///// Error occurs on following line - Cannot find matching method java.io.OutputStream#toByteArray(). Please check if the declared type is correct and if the method exists. /////

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!