- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2017 04:43 AM
I need some assistance in auto-canceling or closing related CTASK items when the CHG is moved to closed incomplete or canceled state. My current UI Action on the change will close the change request, but the underlying task is remaining open in the fulfiller's work queue. Thoughts?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 08:13 PM
HI Cyndi,
You will have to write a Business rule to achieve this
Table : Change_request
Type : After
Insert : true
Update : true
Conditions : current.state == 7 && current.state.changes() // place your values of state accordingly
Script :
abortKids();
function abortKids() {
if (current.sys_id == '')
return;
var kids = new GlideRecord('change_task');
kids.addQuery('parent', current.sys_id);
kids.query();
while (kids.next()) {
if (kids.active == true) {
kids.state = 7;
kids.update();
}
}
}
Note : This can also be achieved using UI action placing the same code. Let me know if you have any issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 12:26 PM
Hi Cyndi
When you move the change from review into Close or Cancel, how are you doing it?
Are you using a ui action, if so could you share the detail of it so we can see what the ui action is doing?
Also if you look at the state choices of your ctasks, are 3,4,7 closed states?
And as a check what is the state choice value for close and cancel on your change table?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2017 08:13 PM
HI Cyndi,
You will have to write a Business rule to achieve this
Table : Change_request
Type : After
Insert : true
Update : true
Conditions : current.state == 7 && current.state.changes() // place your values of state accordingly
Script :
abortKids();
function abortKids() {
if (current.sys_id == '')
return;
var kids = new GlideRecord('change_task');
kids.addQuery('parent', current.sys_id);
kids.query();
while (kids.next()) {
if (kids.active == true) {
kids.state = 7;
kids.update();
}
}
}
Note : This can also be achieved using UI action placing the same code. Let me know if you have any issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 03:24 AM
Thank you Aakash...that worked beautifully!