Problem task should be closed before problem record closure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 11:36 PM
Hi,
In problem management, when I close the problem record the associated problem task should get closed, if not it should throw an error message and abort the action....It is working fine for me but the state changes to closed, throwing an error message and aborting the action but still the state would remains in closed state, when I refresh or go back the state would be in open state (i.e previous state). what should I have to do to make the state field to display the previous value (i.e aborting the action) until I close the problem task record.
Business rule:
Action: Before update
Condition: State changes to closed
Script:
var gr = new GlideRecord('problem_task');
gr.addQuery('active','true');
gr.addQuery('problem',current.sys_id);
gr.query();
if (gr.next()) {
gs.addErrorMessage('Problem cannot be closed before the problem task closure');
current.setAbortAction(true);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2017 12:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2017 02:35 AM
Hi Shishir,
Instead of going till business rule, best way would be not to show close problem button on the form if you already have it for form closure.
If you are allowing user to change the states, then you can write a client script do the synchronous ajax call validate the tasks whether they are open or not.
if open then set state back to oldvalue and if all closed the let them change back to closed state.
thanks and regards,
Girish Deshpande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 10:17 PM
Hey
I am facing same issue, Did you find something to fix this?
Display of the State is Closed which is quite confusing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 10:24 PM
HI,
please try code:
BR - problem
before and update
code:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('problem_task');
gr.addQuery('active','true');
gr.addQuery('problem',current.sys_id);
gr.query();
if (gr.next()) {
gs.addErrorMessage('Problem cannot be closed before the problem task closure');
current.setAbortAction(true);
}
})(current, previous);