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 02:54 AM
Hello @Kunal33
You need to set atleast one field in wm_order table, you can't create a empty record.
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 03:02 AM
Lets say we have an incident whose num is inc 123 and we have created work order by this incident. we have support two work order created wo123 and wo234. if we attach an attchement test.docs on inc123. on this inc we have a ui action on attachment related list.
if we click on ui action on inc123, it will copy the existing attachment test.docs on wo123 and wo234.
I hope my req is clear now
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 03:18 AM
Plz Use this script with correct field names
var gr= new GlideRecord('wm_order');
var wn_num = current.number;
gr.addQuery('work_order_number_field_name', 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 04:08 AM
work_order_number_field_name
which field you are referring here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 04:11 AM
wo123 the field which has this value in wm_order table.