Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to pass user in eventQueue

Preethi26
Tera Contributor

Hi Team,

I am trying to schedule a job that remove users groups and roles who have not logged in for last 3 months.

But while working on notification im stuck as its new for me.

I have gave admin directly in user field of notification in this case its  sending notification for admin but not for specific users  for whom role/group is deleted.

Kindly correct me.

Preethi26_0-1701264133561.png

Preethi26_1-1701264389460.png

 

 

11 REPLIES 11

Prince Arora
Tera Sage

@Preethi26 

 

You can do something like this:

 

gs.eventQueue( 'notify.user', gr, gr.sys_id);

 

This will trigger the event multiple times in the while loop

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

scott barnard1
Kilo Sage

Hi Preethi

When you create an event for the notification you pass 2 parameters to the notification. You need one of them to be the sys_id of the target user.

 

Then in your notification on the "who will receive" tab select parm* contain the recipient. Either parm1 or parm2 depending on the event that you created.

 

I notice that you are trying to use user_name, swap this to sys_id of the recipient

 

Regards