Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How restrict the attachment on the Sc task

is_12
Tera Contributor

Hello,

If I add one add attachment on the catalogue form in the portal. Multiple attachment is getting attached on the Sctask How to limit or restrict this ?

 

Currently I have created an After BR on sc_task table. And in advance 

var attachment=new GlideSysAttachment();
attachment.copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);
current.update();
 

Please help with some solution.

Thanks!!

 

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@is_12 

why are you using current.update() in your BR?

simply use these 2 lines

var attachment=new GlideSysAttachment();
attachment.copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader