We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Use of gs.eventQueue to send notification.

dhara kacha
Tera Contributor

Hi,

 

How do I send notification to sys_updated_by.manager from business rule and notification by using gs.eventQueue? Below code doesn't work. 

 

gs.eventQueue("Redflag.incident.notification", current, current.sys_updated_by.manager);
 
Thanks
 
1 ACCEPTED SOLUTION

Chaitanya ILCR
Giga Patron

Hi @dhara kacha ,

sys_update_by is not a reference field you cannot dot-walk as it is a string field

so remove manager from current.sys_updated_by.manager  and try 

if you want to include manager of sys_updated_by

 

try this

 

var managerID = null;
var userGr = new GlideRecord('sys_user');
if(userGr.get('user_name',current.sys_updated_by)){
	managerID = userGr.getValue('manager');

}

gs.eventQueue("Redflag.incident.notification", current, managerID, null);

else

just use 


gs.eventQueue("Redflag.incident.notification", current, current.sys_updated_by, null);

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

1 REPLY 1

Chaitanya ILCR
Giga Patron

Hi @dhara kacha ,

sys_update_by is not a reference field you cannot dot-walk as it is a string field

so remove manager from current.sys_updated_by.manager  and try 

if you want to include manager of sys_updated_by

 

try this

 

var managerID = null;
var userGr = new GlideRecord('sys_user');
if(userGr.get('user_name',current.sys_updated_by)){
	managerID = userGr.getValue('manager');

}

gs.eventQueue("Redflag.incident.notification", current, managerID, null);

else

just use 


gs.eventQueue("Redflag.incident.notification", current, current.sys_updated_by, null);

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya