gs.addErrormessage is popping on form

sowmyaj
Giga Expert

Hi All,

        In the advance script of BR I have added

                  gs.addErrorMessage('xyz.');

                  current.setAbortAction(true);

                  current.state = previous.state;

The above message is just flashing on the form and disappears. I want to make the message to be visible to the user. how can I do?

Thanks,

Sowmya.

15 REPLIES 15

bala_sn
Kilo Expert

Sowmya,



Check if any of the BRs on that table has the following line of code. If so, then you need to remove that. Or, change the order of execution of that BR and your BR.


gs.flushMessages();


Hi Bala,



        There are no flushmessages in relate to that table


Thanks,


Sowmya


BachAF
Tera Contributor

@sowmyaj,

 

Did you fix the issue? I know it's been 5years ago but I am now running into the same issue.

Could you please share the solution

 

Thanks.

 

Bachtiar

What table?

I've only seen this being an issue when flushMessages() is called somewhere.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Hi Paul,

I am using gs.addErrorMessage() in Business Rule - Advanced script on a custom table.

When to run: before Update

Basically, to prevent the user from making an unwanted update on the form.

I can see the Error Message appears briefly as the form loads, but after the form finished loading, the Error Message disappears.

snippet of my code:

if (groupType.indexOf("77fce8bd71792900002bd97eb7bba44c") == -1 && busSvcTower == "2eed7838dbdef6007921d211ce961932") {

gs.addErrorMessage("This Ticket is currently in HR Tower and you are trying to transfer this ticket to GT Tower's Assignment Group. Please change the Business Service and the Assignment Group accordingly.");
current.setAbortAction(true);

//gs.log("Bachtiar HR BR line 37");
}

current.setAbortAction(true);

-----------------------------------

To clear up your suspicion, I don't see flushMessages() being used currenty in any active BRs.

Thanks.

Bachtiar