How to trigger notification to more than one group through event

Steveanner
Tera Contributor

Hello Community,

 

Can anyone help us to trigger the notification more than one group members through the workflow event activity and it would be great if anyone provide code snippet or syntax for this logic.

Steveanner_0-1688646514275.png

 

 

Thanks,

Steve An

6 REPLIES 6

Sagar Pagar
Tera Patron

Hi @Steveanner,

 

You need to get the all member of groups and return that variable in workflow event activity.

If it is email address, make sure to add it separated by comma.

 

Take a look at old thread: How to send notifications to multiple users in create event?  

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Thanks for the response. It would be helpful if you could provide the syntax to retrieve multiple groups from workflow event activity parameter 1 to trigger notification.

 

Thanks,

Steve An

Steven Parker
Giga Sage

I would do the following:

 

- Create an event on the System Policy -> Registry table (sysevent_register)

- Create a notification in the system, System Notification -> Notifications, that is set to "Send When - Event is fired" and choose your newly created event.  

- On the "Who Will Receive It" tab, you can add users/groups here, check the Event parm 1 contains recipient or Event parm 2 contains recipient boxes...click "Advanced View" under related links if you don't see all these fields.  Obviously, the "What will it contain" tab is what you want in the email.

- Then in your workflow, use a Run Script and you would fire off the notification like the below.  In this example, I am just using current and sending the requester and requested_for as the parm 1 and parm 2 fields.  You can also send data or variables in those fields to use in the email, just don't check the "Event parm # contains recipient" box

 

gs.eventQueue("my_event_I_created", current, current.variables.requester, current.variables.requested_for);

 

 

That's just a quick example of how to do it.  Few steps involved in the process. 

 

Here are some more details from ServiceNow Docs:

StevenParker_0-1688648322598.png

 


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Thanks for the response. Our case was different, and we needed to send to different groups based on the particular conditions. We are looking for a way to include more than one group in the parameter 1 in the workflow event activity to trigger

 

Thanks,

Steve An