current.setAbortAction(true) causes the error message 'Invalid update'

Andrew Pishchul
Giga Expert

Guys,
I got stuck with current.setAbortAction(true) in a business rule... I have a simple business rule on an incident table:
When:

Before

Update:
yes

Condition:
current.category=='Software'&& !current.hasAttachments()

Script:
gs.addInfoMessage("No attached documents found! Operation cancelled.")
current.setAbortAction(true);


But this rule causes and error message 'Invalid update' when I try to save an incident without attachments and with Category='Software'. My custom info message will be displayed as well, but why 'Invalid update' is there???
16 REPLIES 16

Jacob_Andersen
ServiceNow Employee

CapaJC is correct..... that message will always display when you abort the update using current.setAbortAction(true). The only way to get rid of that is to create a client script to remove it from the screen (I wouldn't recommend that).

The error message is a little ugly, but it does describe what happened and that the update did not occur.

If this answers your question, mark the response from CapaJC as the answer.


You're right - it's very ugly. It also gives the end user absolutely no feedback about what went wrong, other than their Update did not occur - i.e. very poor UI design.

This REALLY needs to be developer/Administrator controlled, e.g. I want to:
gs.addErrorMessage("Ooops, you have entered an invalid blah");
gs.setAbortAction(true, false);
(where the second boolean is for 'show the ugly message or not').

That way, if the developer/Administrator has been lazy and hasn't provided a user friendly message, then they can use the default, or they can tailor it to be user friendly (and not ugly).

Can someone put in an enhancement request? 🙂


Also forgot to mention that it can be updated via System UI -> Messages (key 'Invalid update'), to be at least a little more user friendly.


Neha Prasad
Tera Contributor

Hello Andrew,
Were you able to find any solution for this issue?


No, unfortunately I didn't find any good solution for that.