ServiceNow: How to read the content of a text file from an incident record attachment
How to read the content of a text file from an incident record attachment: GlideSysAttachment API is used to handle attachments. With this API, we can copy attachment from one record to another read the content of a attached file as text, base64 or content stream write the content read all attachments of a record and also we can delete any of the attachment of a record var attachment = new GlideSysAttachment (); var incidentSysID = '136e85931bc8fc1037fc4263cc4bcb46' ; var agr = attachment . getAttachments ( 'incident' , incidentSysID ); gs . info ( agr . getRowCount ()); while ( agr . next ()) { var attachmentContent = attachment . getContent ( agr ); gs . info ( 'Attachment content: ' + attachmentContent ); Output: x_67546_crusher: Attachment content: Vamshi Vemula Staff software Engineer