gs.flushMessages() and RP.isPopup() doesnot work in scoped application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2019 09:38 PM
HI,
We've a requirement to show the end-user with an info message on list view as "Use * to search".
We've a display business rule displaying an info message on list view.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var c='Use * to search';
var index=0;
index = gs.action.getGlideURI().toString().indexOf('sn_grc_profile');
if(index == -1){
// it means it is form
}
else{
gs.flushMessages();
gs.addInfoMessage(c);
}
})(current, previous);
When the same business rule is appliced in GRC Profiles scope, compiler error is showing up stating flush message is not allowed in "sn_grc" scope.
We've to flush existing messages since on every list edit the same message is shown up multiple times. I've tried !RP.isPopup() as well but it's not working in sn_grc scope.
Any pointers to fix this?
Thanks
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2019 09:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2019 09:53 PM
Hi Balaji,
You are correct. gs.flushMessages() is not available in scoped apps. Have you considered using gs.clearMessages()
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2019 10:04 PM
hi,
gs.flushMessages() is not available in scoped apps. Have you considered using g_form.clearMessages() from a client script?
https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_GS-flushMessages
If you feel this is a critical method to use in scoped apps, I invite you to open an enhancement request! Our product managers DO listen.
Enhancement requests: Tell us how you would improve the ServiceNow product
NOTE: Mark correct or helpful if it helps you.
Warm Regards,
Raj patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2019 12:26 AM
Thanks everyone for the response.
Is there any other means to show an info message in list view?
Why am I not able to use RP.isPopup(), though?