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

Can you show me the error what is coming

var sysID =gr.Insert(),

 

I put an addinfomessage for sysID and its coming as undefined.

 

Requirement is when we click on UI action it copy the selected attachment to the existing work order related to that incident.

Hello @Kunal33 

 

 

 

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

 

 

 

 

Use this Script

 

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

 

Regards,

Samaksh

 

i dont want to create a new record in work order. i want to add attachment in the work order existing record which is already linked with incident

So what is the reference you are giving for existing record, like the incident attachment should get attach to which record in wm_order.