function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WesCooperWesCooper 

Apex Code to Parse through Text File

Hello, I am very new to SF and Apex code (Not new to OOP, though). I have been searching all over the net for a solution to my problem, but I cannot seem to find one. 

 

We have setup an email service to receive emails and these emails have 1 tab delimited text file attachment. The content of these text files need to be read and uploaded to a DB Object we created. 

 

Does anyone have a link on how to read through an attached text file? If I get that working, then I should be able to do the rest.

 

Any help would be greatly appreciated.

 

Thank you,

 

Wes Cooper

VPrakashVPrakash

Wes Cooper,

 

Use InboundEmail.TextAttachmentObject  to retrieve the attachment from InboundEmail Object

and you can store text attachments as string and  use string methods (like split) to read through the string.

 

More info --> https://login.salesforce.com/help/doc/en/code_inbound_email.htm

 

I hope this helps.

 

WesCooperWesCooper

Thank you! This looks to be what I needed. I'll let you know my  result.

 

Thank you,

 

Wes Cooper