Email Notification

Dhanush Rao K
Tera Contributor

Hello all,

 

Can anyone suggest how to add email addresses to a designated team using  a script in Event record.

 

Regards,

Dhanush

1 REPLY 1

Ruhee Gupta
Tera Contributor

Hi Dhanush,

 

Can you try with below code in a Business rule -

 

// Get the team record based on the team's unique identifier
var teamGR = new GlideRecord('sys_user_group');
if (teamGR.get('unique_identifier', 'your_team_unique_identifier')) {
// Add email addresses to the team's members field
var members = teamGR.getValue('members'); // Assuming 'members' is a field storing members' details
var newEmails = "new.email@example.com,new.email2@example.com"; // Example email addresses to add
var updatedMembers = members + ',' + newEmails;
teamGR.setValue('members', updatedMembers);
teamGR.update();
gs.info("Email addresses added to the team successfully.");
} else {
gs.error("Team not found.");
}

 

Please mark my answer helpful if it worked for you.