- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2017 02:18 AM
when problem ticket closed then related incidents tickets should close automatically, i write below code but that is not working, kindly help me with your suggestions. (function executeRule(current, previous /*null when async*/) { var gr =new GlideRecord('incident'); gr.addQuery('problem_id',current.sys_id); gr.query(); if(gr.next()){ gr.state= '6'; gr.close_code= Solved('Work Around'); gr.close_notes= resolved; gr.update(); } })(current, previous); Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2017 02:40 AM
Hi Divya,
You need to create/modify a after Update Business rule in the Problem ('problem') table with the Conditions and script as per below screenshot. I have tested the code and is working in my instance. Would like to request you to give it a try and let me know.
For your simplicity, I'm providing the code here:
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('incident');
gr.addActiveQuery(); //Cross check only active incidents
gr.addQuery('problem_id', current.sys_id);
gr.query();
while(gr.next()){
gr.state = '6';
gr.close_code = 'Solved (Work Around)';
gr.close_notes = 'The incident is Resolved as the Related Problem is Closed/Resolved';
gr.update();
}
gs.addInfoMessage('The Incident'+ gr.number+' is Resolved');
})(current, previous);
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 11:01 PM
Use this for your requirement and this will help.
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord('incident');
gr.addActiveQuery(); //Cross check only active incidents
gr.addQuery('problem_id', current.sys_id);
gr.query();
if (gr.next()) {
if(current.state=='107'){
gr.state = '6';
gr.close_code = 'Solved (Work Around)';
gr.close_notes = 'The incident is Resolved as the Related Problem is Closed/Resolved';
gr.update();
}
}
//gs.addInfoMessage('The Incident'+ gr.number+' is Resolved');
})(current, previous);
hope it helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2022 05:08 AM
Hi Amlanpal,
Only for New State yet I am unable to resolved the incident automatically.
For in progress, assainged its working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2018 01:58 AM
Hi All,
I want to close problem task as well (p_task) which was created for the parent problem.may i know how can i achieve this?
Regards,
ram