Error message only displaying for a second and then goes away

Aaron Struphar
Kilo Guru

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?

 

AaronStruphar_1-1732215918605.png

 

AaronStruphar_2-1732215951831.png

 

 

(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);

 

 

1 ACCEPTED SOLUTION

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.

View solution in original post

5 REPLIES 5

Brad Bowman
Kilo Patron
Kilo Patron

Have you tried it without the redirect?  You usually don't need that with setAbortAction.

Hi Brad, it's working just fine in my PDI.

Zach Koch
Giga Sage
Giga Sage

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.

ZachKoch_0-1732217522974.png

Made a copy of your BR here

ZachKoch_1-1732217556695.png

ZachKoch_2-1732217571255.png

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

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.