The CreatorCon Call for Content is officially open! Get started here.

UI action to copy attachment from incident table to existing work order records

Kunal33
Tera Expert

Hi Team,

We have a requirement to create a UI action--Copy attachment to work order on attachment related list on incident form . With this UI action, when we select attachment and click on this button, it copy the selected attachment and move the attachment to related work orders. 

34 REPLIES 34

Hello @Kunal33 

 

Plz check my latest solution

 

 

var gr= new GlideRecord('wm_order');
gr.initialize();
gr.field_name = "Samaksh";  // you need to set atleast one field in the table
var sysID = gr.insert();

GlideSysAttachment.copy('incident', current.sys_id, 'wm_order',sysID);

gs.addInfoMessage("Attachment updated");
var mySysID = current.update();

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

@Kunal33 

I explained it in detail along with steps and script link

did you start from your side?

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

@Kunal33 

you got a chance to review the above?

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

Not yet @Ankur Bawiskar . working on some other task. i will check this and let you know.

 

Thanks!

Hello @Kunal33 

 

Plz Apply the script which i shared with you recently,

 

 

var gr= new GlideRecord('wm_order');
var wn_num = current.number;
gr.addQuery('initiated_from', wn_num);
gr.query();
var sysID="";
if(gr.next()){
sysID = gr.sys_id;
}

GlideSysAttachment.copy('incident', current.sys_id, 'wm_order',sysID);

gs.addInfoMessage("Attachment updated");
var mySysID = current.update();

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh