UI action to copy attachment from incident table to existing work order records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 12:54 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 05:03 AM
UI action is on Global table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 05:17 AM
Can we Connect ? @Kunal33
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 05:25 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 05:56 AM
this is UI action created on incident table.
This is work order table and initiated from is the field which store incident num
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 06:09 AM
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