- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2012 08:51 AM
I am trying to figure out how to hide some of my status items on a request item until all related tasks are closed. I reied simply hiding the options but then my Request Items would not auto close when the tasks closed.
Below is my fumbling attempt:
// Hide "Closed" Incident state from everyone but itil_admin function onLoad() { var optsk = new GlideRecord('task'); optsk .addQuery('request_item','number'); optsk .addQuery('state', optsk.state<4); optsk .query(); while (optsk .next()) { g_form.removeOption('state', 4); g_form.removeOption('state', 7); g_form.removeOption('state', 10); g_form.removeOption('state', 11); } }
The basic premise is that we don't want folk to close request items manually. We have a rule that closes them automatically when the tasks are all closed. My perfect world would be a simple rule that prevents closing a request item if there are any open tasks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2014 03:43 AM
Here is what we did for our Problem table to prevent problem closure if there were any active tasks. We created a business rule with the following conditions:
- Source Table = Problem
- Order = 10
- Active = Checked
- When = Before
- Insert and Update = checked
- Condition =
current.state == 7
- Script = =
//Query for associated active tasks
//Should be run as a 'before' business rule on the change_request table
var rec = new GlideRecord('problem_task');
rec.addQuery('problem', current.sys_id);
rec.addQuery('active', true);
rec.query();
//If any of the tasks are active abort the submission
if(rec.hasNext()){
gs.addInfoMessage('All Problem Tasks must be closed prior to closing the Problem');
current.setAbortAction(true);
}
Hope this helps you
~Conan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2012 08:59 AM
Why not just make the field read-only?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2012 09:06 AM
The techs need to be able to mark things to Work in progress, pending, or pending change. We just don't want them to be able to choose close complete, close incomplete, etc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2012 01:06 PM
Nevermind, I managed to get a different solution in here. Thanks anyway.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2014 04:42 AM
Hi Conan,
I am trying to do the same. Where I would like to prevent closing the request if tasks are open.
Are you able to share where you found this solution.
Many Thanks,
Shoaib