Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

gs.flushMessages() does not work on Scoped application

sushmuttalli
Kilo Contributor

Hi,

I need to avoid multiple messages popping up in the list view when we do a mass update , for this we used Flushmessages() , but it doesnt work  on Scoped application. Is there any way we can avoid multiple info messages from the list? 

4 REPLIES 4

Jaspal Singh
Mega Patron
Mega Patron

Hi Sushmutalli,

 

I guess gs.flushMessages() does not work in Scoped application. As an alternative you can look for g_form.clearMessages()

 

Thanks,

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

I have to run it on Server side , Is there any other alternative to clear the previous messages on server side?

Doug Rezabek
Tera Contributor

I get that this is a dated thread but I came across it dealing with this same issue today...so I thought I would throw my "solution" out there.  I have a script include with various "utils" function in my scoped app.  Per this thread, in this context, gs.flushMessages() does NOT work.  So I created a second script in the global scope with a single function to call gs.flushMessages().

 

I have NO clue why flushMessages is not available in a scoped app; this is a complete head scratcher to me personally.  But this "solution" (aka workaround) does do the trick.  Hopefully this helps someone else down the road.

 

Scope app script include:

new global.stsAdminUtils().flushMessages();

 

Global script include:

var stsAdminUtils = Class.create();
stsAdminUtils.prototype = {
initialize: function() {},

flushMessages: function() {
     gs.flushMessages();
},

type: 'stsAdminUtils'
};

Do you think this would work on portal? Or only on backend? I am having an issue when using a catalog item that adds roles. Whenever we hit the approve request button, the screen goes full on crazy. 

cielocharomarti_0-1737036688276.png