Created
January 15, 2016 05:20
-
-
Save pmgupte/df835d6cdacf0345c2bc to your computer and use it in GitHub Desktop.
Servicenow script - How to read attachment to a table record.
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 grSysAtt = new GlideRecord('sys_attachment'); | |
grSysAtt.addQuery('table_name', 'my_table'); // name of table whose record have attachment | |
grSysAtt.addQuery('table_sys_id', '557d2d9f4fb416406b6500f18110c71c'); // sys_id of record having attachment | |
grSysAtt.query(); | |
while (grSysAtt.next()) { | |
var sa = new GlideSysAttachment(); | |
var attachmentContents = sa.getContent(grSysAtt); | |
gs.info(attachmentContents); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
grSysAtt.addQuery('table_sys_id', '557d2d9f4fb416406b6500f18110c71c');
how can we dynamically get the table_sys_id for the latest attachment on attachment table?