gs.addInfoMessage not working in onBefore business rule?

Options
- 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
}
}
7 REPLIES 7

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2019 10:11 AM
Hi Mitch,
(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())
{
gs.log('Record found');
if(gr.name)
{
gs.log('Name is ',gr.name);
if(gr.u_linked_business_service)
{
gs.log('BS is ',gr.u_linked_business_service);
current.business_service = gr.u_linked_business_service;
}
current.company=gr.company;
current.location=gr.location;
current.update();
gs.addInfoMessage('Hello');// doesn't work
}
}
Try using something as above & check for logs.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2019 10:32 AM

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2019 10:40 AM
Thanks Mitch that helps.
Can you replace
current.company=gr.company;
current.location=gr.location;
current.update();
gs.addInfoMessage('Hello');// doesn't work
with
gs.log('Company is ',gr.company);
current.company=gr.company;
current.location=gr.location;
current.update();
gs.addInfoMessage('Hello');// doesn't work
gs.log('Infomessage displayed');
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2019 11:03 AM