Attachment in Incident created via Client Script

Stiips
Tera Contributor

Hi, I have Service Catalog Form that has an option to create either Request or Incident. For Request, I have no issues since it is automatically attached. But when Incident is Selected, since Service Catalog creates only requests, I have created Client Script on submit to insert a new Incident and I'm not sure how to attach the attachment added in the form. I'm a bit stuck on how can I attach an attachment added in a Service Catalog form to an Incident created via Client Script. 

Any ideas or suggestion is greatly appreciated.
Thanks

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

In server scripts there is a method available to copy attachments from a source to target record.  You could call this from a Business Rule on the incident table before or after insert if there is any link established between the incident and RITM records.  If not, or maybe even better depending on your script to insert the incident record you could call this after the insert() using the incident sys_id that was just created.  The documentation gives a clear example and explanation of how to use this:

 

GlideSysAttachment