The Now Platform® Washington DC release is live. Watch now!
‎08-10-2017 07:44 AM
Hi,
Requirement is to download all attachments related to incidents present in instance and it should be done in few clicks not in a away that we need to click 2k-3k times.
name of attachments can be manage, i created a script which will append incident number to file name of attachment.
Any leads will be appreciated.
Regards
Manas
‎08-10-2017 07:46 PM
Hi Manas,
You could use the provided API :
Attachment API - GET /now/attachment
Attachment API - GET /now/attachment/{sys_id}
Also another way is to create an external script to loop through all attachments linked to incidents for example, and then generate the URL from the attachment table :
https://myinstance.service-now.com/sys_attachment.do?sys_id=xxxxxxxx (xxxxxxxx is the sys_id of the sys_attachment record)
The link above will download your file with the correct name. If you have a script to do this for you you can also have it record which incident/change this belongs to.
Cheers
‎08-10-2017 08:03 PM
Please check if this helps: https://www.servicenowguru.com/scripting/download-attachments-zip-file/#comment-34336
‎08-10-2017 08:13 PM
Can only be done as xml. no other format.
You can try the link mentioned in Shishir's response and follow this post for more discussions and ideas: How to download the attachment from multiple Incidents
‎07-22-2019 06:44 AM
Hi, may be it was useful for you.
I used BR.
Script find sys ID of attachment and after use redirect URL to download it.
(function executeRule(current, previous /*null when async*/) {
var sysIdOfAtt;
var grA = new GlideRecord('sys_attachment');
grA.addQuery('table_sys_id', current.sys_id); // document's sys ID which has attachment
grA.query();
if (grA.next()) {
sysIdOfAtt = grA.sys_id;
}
action.setRedirectURL('sys_attachment.do?sys_id=' + sysIdOfAtt);
})(current, previous);