How to copy attachments from TASK to RITM

raj99918
Tera Contributor

Hi 

 

How to copy attachments from TASK to RITM

6 REPLIES 6

Hi @raj99918 , 

 

Its working  for me in my PDI

SohithanjanG_0-1709231834305.pngSohithanjanG_1-1709231846854.png

 

Please mark the answer as Accepted as Solution & hit helpful if it suffices  your requirement !!

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

Sandeep Rajput
Tera Patron
Tera Patron

@raj99918 You can use GlideAttachment copy method to copy the attachments from one GlideRecord to another.

 

Here is a example

 

var attachment = new GlideSysAttachment();
var incidentSysID = 'ab1b30031b04ec101363ff37dc4bcbfc';
var incGR = new GlideRecord('incident');
incGR.get(incidentSysID);

var copiedAttachments = attachment.copy('incident', incidentSysID, 'problem', incGR.getValue('problem_id'));
gs.info('Copied attachments: ' + copiedAttachments);

 

For more information, please refer to https://developer.servicenow.com/dev.do#!/reference/api/vancouver/server_legacy/GlideSysAttachmentGl...

 

Hope this helps.