On the Service Portal, addInfoMessage disappears too quickly...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2017 03:37 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2019 06:55 PM
So I had an opposite need, where the notifications had to disappear after 1 second (they were sticking around too long).
Poking around in /scripts/js_includes_sp.jsx I found that I could do this within the Client Script of a Service Portal Widget:
spUtil.addInfoMessage("TEST");
$rootScope.$broadcast("$$uiNotification", {type: "info", message: "message"});
$scope.f_flushMessages = function() {
$timeout(function(){
$rootScope.$broadcast("$$uiNotification.dismiss");
},1000);
};
$scope.f_flushMessages();
So, something to note... I went this route because the widget was in a scoped application, and you cannot use gs.flushMessages() in a scoped app!
Note: spUtil.addInfoMessage('message') is simply a shortcut for $rootScope.$broadcast("$$uiNotification", {type: "info", message: "message"});
Anyway... in my Server Side widget code, use a lot of gs.addInfoMessage() calls, but I do this to clear them quickly:
Client Script example
$scope.f_flushMessages = function() {
$timeout(function(){
$rootScope.$broadcast("$$uiNotification.dismiss");
},1000);
};
$scope.someFunctionThatCallsServerCode = function() {
c.server.update().then(function(response) {
$scope.f_flushMessages();
});
};
Server Script example:
(function() {
if (input)
gs.addInfoMessage("Hey, I updated!");
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2023 09:42 AM
There is SN KB on this: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0713722
system property 'glide.service-portal.notification_timeout.seconds' controls it and accessibility settings