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

Read File Contents From Attached File

edited Nov 10, 2018 3:51PM in Sales 1 comment

Summary

Read File Contents From Attachments in Groovy

Content

Hi Team, 

We are trying to read the File contents from attachments of Custom object. We are using following the groovy script to read the file contents. 

def attachement_coll=Attachment

while(attachement_coll.hasNext())

{

def attchment=attachement_coll.next();

def  f_content=attchment.FileContents

}

 

With above code we are able read file contents from TEXT file,. However, If file type is EXCEL / PDF content is not properly. 

Please let us know way forward to read file content from if attachment is EXCEL/PDF. 

Regards. 

Madhu

Code Snippet

def attachement_coll=Attachment

while(attachement_coll.hasNext())

{

def attchment=attachement_coll.next();

def  f_content=attchment.FileContents

}

Howdy, Stranger!

Log In

To view full details, sign in.

Register

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