- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2018 10:34 PM
I have a List choice UI action which on selecting will open a glide dialog window asking for confirmation to send a mail to the selected list entries.. This I have achieved by calling a script include in the UI Action. The script include queries the table and sends the mail. For me the window appears. On confirmation the mail is also sent. But the message in gs.addInfoMessage is not displayed anywhere. Where am I going wrong? Can anyone please help ? I am in serviceNow London version.
var comSentAJAX = Class.create();
comSentAJAX.prototype = Object.extendsObject(AbstractAjaxProcessor, {
ajaxcom: function() {
var id = this.getParameter("sysparm_id");
var gr = new GlideRecord('alm_asset');
gr.addQuery('sys_id','IN', id);
gr.query();
while(gr.next())
{
gs.eventQueue('comp.sent',gr, gs.getUserID(), gs.getUserName());
gs.addInfoMessage("Emails sent");
}
},
type: 'comSentAJAX'
});
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2018 07:16 AM
Hi Muktha,
I think as you are reloading the window once you get the ajax response that is the only reason why you are not able to see the info message on your list view. because if you reload the window the info or error message will disappear.
var Close = function() {
reloadWindow(window);
};
ga.getXMLAnswer(Close.bind(this));
return true;
};
please try not to reload window once you receive the ajax response.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2018 07:29 AM
Hi Ian,
The extra errand is not there in my actual script include. While copying it in my query here some mistake had happened. The message is not getting displayed . I don' t understand where I am going wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2018 08:12 AM
The only time I've seen a gs.addInfoMessage not display from a script include is if the script (or some part of it) failed to run.
So, if the UI Action is correctly calling the script include, which in turn is correctly triggering the event queue, then the message should work.
During my recent work on creating and troubleshooting a script include I made extensive use of gs.addInfoMessage("") and gs.addErrorMessage("") to identify which bits were working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2018 08:20 AM
Give these edits a try and see if you get either message displaying.
var comSentAJAX = Class.create();
comSentAJAX.prototype = Object.extendsObject(AbstractAjaxProcessor, {
ajaxcom: function() {
var id = this.getParameter("sysparm_id");
var gr = new GlideRecord('alm_asset');
gr.addQuery('sys_id','IN', id);
gr.query();
if(gr.next())
{
gs.eventQueue('comp.sent',gr, gs.getUserID(), gs.getUserName());
gs.addInfoMessage("Emails sent");
} else {
gs.addErrorMessage("Emails not sent");
}
},
type: 'comSentAJAX'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2018 06:42 AM
Something interesting I almost forgot about... in the Server side code, try using UINotification. Here's an article in the community that discusses it and gives and example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2018 07:16 AM
Hi Muktha,
I think as you are reloading the window once you get the ajax response that is the only reason why you are not able to see the info message on your list view. because if you reload the window the info or error message will disappear.
var Close = function() {
reloadWindow(window);
};
ga.getXMLAnswer(Close.bind(this));
return true;
};
please try not to reload window once you receive the ajax response.
Thanks