- 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-12-2018 03:20 AM
Hi Mahendra,
You are right. The reloading of window is causing this problem. The message is getting displayed once the reloading is omitted.
But, gs.addInfoMessage to be added to the script include only. If used in the UI action after the script include call, even if the reloading of window is omitted the message is not getting displayed .
Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2018 03:51 AM
Hi Muktha,
Yes..you will need to use gs.addInfoMessage in Script include only. In UI action you can use g_form.addInfoMessage() instead of gs.addInfoMessage as your UI action has client side code. But I think you are showing info message in List view and hence g_form.addInfoMessage will not work in UI action(I think so). g_form.addInfoMessage() will work in UI action only to show info message on the form and not in List view. So in short you need to use gs.addInfoMessage() in script include.
Please mark this as correct/helpful, if it resolves your issue.
Thanks