- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2024 11:11 AM
We have a business rule that prevents a problem record from being resolved if there are open problem tasks. The business rule is working as expected, however, the error message is only displaying on the screen for like a second and then it goes away. Any suggestions on how we can fix this and get the error message to stick around?
(function executeRule(current, previous /*null when async*/ ) {
var OpenproblemTaskGr = new GlideRecord("problem_task");
OpenproblemTaskGr.addQuery("problem", current.sys_id);
OpenproblemTaskGr.addActiveQuery();
OpenproblemTaskGr.query();
if (OpenproblemTaskGr.next()) {
gs.addErrorMessage('This Problem cannot be resolved as there is or are active child Problem Tasks. Please close them first.');
current.problem_state = previous.problem_state;
current.state = previous.state;
current.setAbortAction(true); //abort the record
gs.setRedirect(current);
}
})(current, previous);
Solved! Go to Solution.
- Labels:
-
Problem Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2024 11:02 AM
Hi Zach, I was looking through business rules, client scripts, and UI policies and I found an old UI policy that we are no longer using but it was active and the execute if false was clearing messages. Once I inactivated this, the error message was staying! Thanks for the suggestion to look at other scripts/rules.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2024 11:20 AM
Have you tried it without the redirect? You usually don't need that with setAbortAction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2024 11:58 AM
Hi Brad, it's working just fine in my PDI.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2024 11:34 AM
You most likely have another business rule that is flushing the messages. I built your same BR with the same conditions and same script and tested it and it works fine, the message doesn't disappear.
Made a copy of your BR here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2024 11:59 AM
Hi Zach, that must be it. I also tried in my PDI and it's working as expected. I will look at other business rules to see if there's something like you mentioned.