Closing all task manually before moving to another state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 05:07 AM
In change request i have following
I have IMPLEMENT UI Button, once it is clicked it will take to Review State
before moving to REVIEW state I need to closed all the task (created manually or from work flow). As you can see that The task is till pending showing above and State has moved to Review.
Please not : I want to make compulsary to user to closed all the task manually, not automatic closed.
Can some help me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 05:24 AM
How Mujtaba?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 05:34 AM
Chuck Tomasi gave you the code already. But if you want to do in in the UI Action itself then try this
var parentID = current.sys_id;
var count = 100;
var ctask = new GlideAggregate('change_task');
ctask.addAggregate('COUNT');
ctask.addQuery('change_request', parentID);
ctask.addQuery('active', true); // check how many active requests we have
ctask.query();
if (ctask.next()) {
count = ctask.getAggregate('COUNT');
}
// If no active requests were found, then return true (all child tasks are closed)
if (count == 0) {
return true;
}
addErrorMessage('Please close all open tasks for this change req');
return false;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 05:42 AM
Can i put this directly in UI Action script.
It already contain other codes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 05:43 AM
Yes, put it in the beginning.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 05:48 AM