Unable to copy RITM attachments to related records using Business rule

Anjali Priya
Tera Contributor

I'm trying to copy attachments uploaded on a catalog form (while raising the RITM) to related records (in another table), but it's not working using a Business rule.
My actual requirement is: 

  • User submits a catalog form.
  • Multiple excel files are attached to to the form while submitting.
  • Each file name represents a unique ID (like 1001, 1002, 1003...).
  • After RITM creation, each attachment should be copied to the matching record (respectively) in a custom table (which has the records having values like 1001, 1002, 1003...).

I have tried creating a BR on sc_req_item table (After - insert) and used GlideSysAttachment,copy() as well as copyBySysId() APIs, but either they are copying all the attachments in all the records, or not copying them at all.

What is the recommended/best-practice way to copy the attachments respectively to the records in another table?
Any guidance would be appreciated. Thanks!

 

2 REPLIES 2

DGAJ
Giga Guru

Hi @Anjali Priya ,

Here is a video on how to copy attachment from one table to the other:

Copy Attachments from one table to another | Before Business Rules | ServiceNow

 

*******************************************************************************************
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards,

DGAJ

WillieW
Tera Expert

Post your BR definition, included the script (as text). Then you can get some real assistance. Example is here:

 

GlideSysAttachmentGlobalAPI#GSA-copy