gs.addInfoMessage not working in onBefore business rule?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2019 10:07 AM
Trying to create a popup after this business rule runs, but it's not working.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr= new GlideRecord('cmdb_ci');
gr.addQuery('sys_id',current.cmdb_ci);
gr.addQuery('sys_id','!=','89c9a7130fe6bec07122abf8b1050eea');
gr.addQuery('sys_id','!=','81c8ec22dbf13700d82851d7f496199f');
gr.query();
if(gr.next())
{
if(gr.name)
{
if(gr.u_linked_business_service)
{
current.business_service = gr.u_linked_business_service;
}
current.company=gr.company;
current.location=gr.location;
gs.addInfoMessage('Hello');// doesn't work
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 06:08 AM
Hi Mitch,
Can you check link once.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2019 10:18 AM
Hi there,
Like Jaspal already mentioned, try debugging your code with for example gs.info statements (Jaspal mentioned gs.log, also fine). This could shorten your search a lot, if you spot quicker where the code is stuck.
Though something I did already notice about your addQuery. Your querying a sys_id (which is unique) and also querying twice on sys_id !=. This doesn't make sence? I would say first rethink your addQuery.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 05:58 AM