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 01:03 AM
Hello @Kunal33
Use this Script :-
var gr = new GlideRecord('destination_table');
var sysID = gr.insert();
GlideSysAttachment.copy('incident_table, current.sys_id, 'destination_table', sysID);
var mySysID = current.update();
current.deleteRecord();
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 01:14 AM
HI ,
We have created a UI action on Global table. please check the below code:_
Condition:- RP.isRelatedList() && current.getTableName()== 'sys_attachment' && parent.sys_class_name == 'incident';
Script
var gr= new GlideRecord('wm_order');
var sysID = gr.Insert();
GlideSysAttachment.copy('incident', current.sys_id, 'wm_order',sysID);
gs.addInfoMessage("Attachment updated");
var mySysID = current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 01:59 AM
Yes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 02:28 AM
i tried with above but nit working