- 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 04:28 AM
Can you share your code?So that i can suggest you something.
Regards,
Pooja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2019 01:43 AM
Hi Pooja,
Please check the below code .
BR on Incident task table:
after: update
var task = new GlideRecord('incident');
task.addQuery('sys_id', current.incident);
task.query();
while(task.next()){
GlideSysAttachment.copy('incident_task',current.incident, 'incident', current.sys_id);
}
Thanks,
Khasim
- 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-06-2019 04:52 AM
Thank you Varsha , it's working