- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2016 11:23 AM
The requirement is that when we try to close the parent incident while child incidents is open, we should not be able to do that. I wrote BR,before update, but it doesnot work,
please help
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('incident');
gr.addQuery('active',true);
gr.addQuery('parent',current.sys_id);
gr.query();
while(gr.next())
{
gr.setAbortAction(true);
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2016 12:27 PM
nope, last row is wrong in your script, sorry missed that.. it should be current.setAbortAction(true); you have gr.setAbortAction(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2016 12:27 PM
nope, last row is wrong in your script, sorry missed that.. it should be current.setAbortAction(true); you have gr.setAbortAction(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2016 12:40 PM
Thanks, it works.
Can you help me to understand this code and let me know if I am wrong.
var gr = new GlideRecord('incident');// in this line we point to the incident table
gr.addQuery('active',true);//here we added the query to select only the records in which active=true
gr.addQuery('parent',current.sys_id);// what happens here?
gr.query();// we execute the query
while(gr.next())//while loop and we point to the next record
{
gr.setAbortAction(true);//we stop the current action
}
Please correct me if I am wrong