- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 02:50 AM
Hi Team,
How can we copy attachments from incident task table to incident table?
Please help on this
Thanks,
Khaism
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2019 04:15 AM
Hi,
write BR on incident_task table like after insert/update
if you need you can write condition like
incident isnotempty
and code like bellow,
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr=new GlideRecord('incident');
gr.addQuery('sys_id',current.incident);
gr.query();
//gs.addInfoMessage(gr.getRowCount());
if(gr.next())
{
GlideSysAttachment.copy("incident_task",current.sys_id,"incident",gr.sys_id);
}
gr.update();
})(current, previous);
code ll copy attachment to related incident.
varsha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 02:58 AM
Hi Khasim
Check below link, this will be helpful.
-harsh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 03:07 AM
Hi ,
you can go once below link this links definitely give you solution:
in below links code you can set the according to requirement table & field name .
https://community.servicenow.com/community?id=community_question&sys_id=b6a5c242db6417884816f3231f961953&view_source=searchResult
If my suggestion helped then please Mark the correct & helpful.
so other community members can benefit from this information.
Thanks
Sanjay Bagri
||DxSherpa Tech. ||
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 03:37 AM
Hi,
You can use below function to copy attachment from one table to another table
GlideSysAttachment.copy('sourcetable', 'sys_id', 'destinationtable', 'sys_id') Make sure you need to use this in after Insert Business rule in the Attachment
You can use below function to copy attachment from incident task table to incident table
GlideSysAttachment.copy('incident_task' ,current.sys_id ,'incident' ,'sys_id');
please mark correct/helpful if it helps for you.
Regards,
Pooja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 04:13 AM
Hi Pooja,
It was not working, we have to query incident task table ?
Thanks in advance !!
Regards,
Khasim