How we can copy attachment from incident table to problem table field of type 'File Attachment'?

PrashantLearnIT
Giga Sage

How can we copy an attachment from the incident table to the problem table field of type 'File Attachment'?

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************
7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@PrashantLearnIT 

Do these steps in scripting.

1) Copy the file to problem record

2) then query sys_attachment table with problem sysId

3) then update the table name from problem to "ZZ_YYproblem"

File will be moved to attachment field type and will be removed from problem record

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

Hi @Ankur Bawiskar 

 

I have 3 different fields where I need to do it ZZ_YY adds attachment to the first field only, there are 4 5 file attachment fields, how to add in specific fields

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************

@PrashantLearnIT 

Seems you might have to add some other logic to add file to remaining fields as well

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