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.

sending email to assignment group members

Deepika54
Tera Contributor

Hello experts,

 

From the script include i have the incident sysid. From the script include, I need to send an email to all the assignment group members.

 

Can anyone help me what to pass in the parm1 so that i can call the notification using gs.eventqueue

1 ACCEPTED SOLUTION

Shraddha Kadam
Mega Sage

Hello @Deepika54 ,

 

Use below script -

var groupMemeber = new GlideRecord("sys_user_grmember");
groupMemeber.addQuery("group.name=<YOUR GROUP NAME HERE>");
groupMemeber.query();

while(groupMemeber.next()){
    var param = {
        "approver_name" : current.approver.getDisplayValue(),
        "group_memeber_name": groupMemeber.user.getDisplayValue();
    }

    gs.eventQueue("<EVENT CREATED>", current, groupMemeber.user.toString(), param);
}
If my response was helpful, please mark it as correct and helpful.
Thank you.

View solution in original post

8 REPLIES 8

Shraddha Kadam
Mega Sage

Hello @Deepika54 ,

 

Use below script -

var groupMemeber = new GlideRecord("sys_user_grmember");
groupMemeber.addQuery("group.name=<YOUR GROUP NAME HERE>");
groupMemeber.query();

while(groupMemeber.next()){
    var param = {
        "approver_name" : current.approver.getDisplayValue(),
        "group_memeber_name": groupMemeber.user.getDisplayValue();
    }

    gs.eventQueue("<EVENT CREATED>", current, groupMemeber.user.toString(), param);
}
If my response was helpful, please mark it as correct and helpful.
Thank you.

Hello @Deepika54 ,

 

Did my answer resolve your question?

If my response was helpful, please mark it as correct and helpful.
Thank you.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Deepika54 

 

Please check in your group if the member is included is true, if yes, teh members wil get email.

 

DrAtulGLNG_0-1752659158442.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

dhoang22
Tera Contributor

Hi @Deepika54,

 

Hope the following instructions help answer your query:

 

1. Event Registration
Name: incident.notify.assignment_group

Table: Incident

 

2. Notification Setup
Table: Incident

Trigger: Event is fired (incident.notify.assignment_group)

Recipients: Assignment Group under Users/Groups in Fields

 

3. How To Use

 

var grIncident = new GlideRecord('incident');
if (grIncident.get(incidentSysId)) {
  // Trigger the event to notify assignment group. 
  // 'parm1' adds context and can be used in the notification as: Incident ${number} - ${event.parm1}
  gs.eventQueue('incident.notify.assignment_group', grIncident, 'Notify Assignment Group', '');
}

 

 

Please mark any helpful or correct solutions as such. That helps others find their solutions.

 

Best regards,

Duc Hoang