Skip to content

Commit b00911c

Browse files
authored
Cc all group members (#1552)
* Create readme.md * Create cc all group members.js Code to CC all group members * Update readme.md * Update readme.md * Update cc all group members.js
1 parent 7cf9aaf commit b00911c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
2+
/* Optional EmailOutbound */
3+
email, /* Optional GlideRecord */ email_action,
4+
/* Optional GlideRecord */
5+
event) {
6+
7+
8+
// Add your code here
9+
var grp = new GlideRecord('sys_user_grmember'); //Query to the group member table
10+
grp.addQuery("group", current.assignment_group); //add a filter to query based on the current record's assignment group
11+
grp.query();
12+
while (grp.next()) {
13+
email.addAddress('cc', grp.user.email, grp.user.name); //Passing email as name and 2nd and 3rd parameter
14+
}
15+
16+
17+
18+
19+
})(current, template, email, email_action, event);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This mail script can be used to CC all members of a group in the current record context.
2+
3+
Use case:
4+
CC all members of the assignment group for the current record.
5+
6+
Solution:
7+
Create the mail script as mentioned in cc all group members.js file and then call the mail script in you email notification using ${mail_script: your mail script name} in the notification body

0 commit comments

Comments
 (0)