- 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 11:29 AM
I've seen the same script in the docs, try:
Name: Prevent Closure if Child Task is Active
Type: "Before Update" Business Rule
Table:
Description: Prevents closing a task if any of the task's child tasks are still active.
Parameters:
Script:
var gr = new GlideRecord('task');
gr.addQuery('active','true');
gr.addQuery('parent',current.sys_id);
gr.query();
if (gr.next()) {
current.setAbortAction(true); }
In your case, just replace 'task' with 'incident', OR add a run condition for task type = incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2016 11:42 AM
I want only for incident table, not the task table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2016 12:12 PM
replace first like with var gr = new GlideRecord('incident') lie Darius says...
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2016 12:20 PM
Then it will be exactly the same as my client script mentioned above, and it is not working