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

UI action is on Global table

Can we Connect ? @Kunal33 

How?

 

Requirement is simple. need a UI action on attachments related list on incident table. When we click on that Ui action , it copies what ever attachment we select on target table( you can take any target table like sc_req_item). 

 

Try this in  PDI and let me know if you able to achieve it.

Kunal33_0-1689253396742.png

 

this is UI action created on incident table.

 

Kunal33_1-1689253430886.png

 

This is work order table and initiated from is the field which store incident num

 

Hello @Kunal33 

 

 

var gr= new GlideRecord('wm_order');
gr.addQuery('initiated_from', "incident_num");  // enter any static incident number which is also a number in work order table record just for testing.

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();

 

 

Try this to test once whether script is working or not.

 

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

 

Regards,

Samaksh