Error message vanishes

kuttti
Kilo Guru

Hello Community,

When the below code - the error message vanishes and form reloads but I want error message to stay so that user/developer knows why it is aborted. Should I just place error message at end.

gs.addErrorMessage("Unable to approve it. please contact admin");
current.setAbortAction(true);

gs.setRedirect(current);

Thanks!

5 REPLIES 5

Filipe Cruz
Kilo Sage
Kilo Sage

Hello kutti,

From the following knowledge article, there is no workaround for that issue:

The Info Message disappears too quickly while redirecting a record producer in Service Portal

Hope this helps!

Please mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Best Regards,

Filipe Cruz

kuttti
Kilo Guru

I am using this code in BR not in record producer.

 

Thanks!

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Kutti,

It's the combination of setAbortAction(true) with setRedirect() as mentioned in the following Now Support page.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0539962

Maybe use current.setWorkflow(false) instead of current.setAbortAction(true).

Ravi9
ServiceNow Employee
ServiceNow Employee

maybe try to convert the checks in client side ? that way you can put some timeout and delay redirection