Last active
January 23, 2022 00:12
-
-
Save thisnameissoclever/487c584367184f2b5eaa32acbee44bef to your computer and use it in GitHub Desktop.
Get the string value of an attachment (which must be a text-formatted file, like .txt, .csv. or .xml) in ServiceNow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tableName = 'incident'; | |
var sysIDOfRecord = '755d52b137b0b30090b68cf6c3990e6f'; | |
var fileNameSansExtension = 'example text doc'; //Full file name: example text doc.txt | |
var grRecordWithAttachment = new GlideRecord(tableName); | |
grRecordWithAttachment.get(sysIDOfRecord); | |
var gsa = new GlideSysAttachment(); | |
//ONLY works in global | |
var textVal = gsa.get(grRecordWithAttachment, fileNameSansExtension); | |
gs.print(textVal); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment