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:39 AM
Can you show me the error what is coming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 02:43 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 02:51 AM - edited 07-13-2023 02:53 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 02:55 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 02:57 AM
So what is the reference you are giving for existing record, like the incident attachment should get attach to which record in wm_order.