We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Bulk uploading of attachment to Hardware Asset

saranyavs
Tera Expert

Hi team,

 

We have a new requirement to attach a file to 100 assets. Do we have any option to bulk upload the attachment in SericeNow? can we achieve this via list actions? 

 

Regards,

Saranya

1 REPLY 1

PrajaktaG308421
Mega Guru

Hello @saranyavs ,

 

1.No we are not supposed to use the Import option on a list view to attach files.
2.Use a Background Script to bulk-copy an attachment to multiple asset records.


3.You can try this script first on PDI and after that you can implement on real time instance if it worked,


var attachmentSysId = "PUT_YOUR_ATTACHMENT_SYSID";

var ga = new GlideSysAttachment();
var assets = new GlideRecord("alm_asset");


assets.addQuery("sys_id", "IN", "comma,separated,sys,ids");
assets.query();

while (assets.next()) {
ga.copy("sys_attachment", attachmentSysId, "alm_asset", assets.sys_id);
}