- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 08:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 09:33 AM
Hi @NiloferS ,
Please try the below:
(function runMailScript(current, template, email, email_action, event) {
var grpmembers = new GlideRecord('sys_user_grmember');
grpmembers.addEncodedQuery('group=420ebf345893e100ac315518e955d88e'); //Replace with your group's sysid
grpmembers.query();
while(grpmembers.next()){
email.addAddress('cc', grpmembers.user.email.toString());
}
})(current, template, email, email_action, event);
Please Mark My Response as Correct/Helpful based on Impact
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 09:40 AM
Hi @NiloferS
I would recommend having DL group for the group members and the email to be set on the group email of group record
and use the below script in the mail script :
email.addAddress("cc","<email_address_of_the_Group>");
But still, you can proceed with manually adding a user using the script below
var grpmem = new GlideRecord('sys_user_grmember');
grpmem.addQuery('group','<sys_id of group>'); //Replace with your group's sysid
grpmem.query();
while(grpmem.next()){
email.addAddress('cc', grpmem.user.email.toString(),grpmem.user.name.toString());
}
Mark this as Helpful / Accept the Solution if this clears your issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 09:33 AM
Hi @NiloferS ,
Please try the below:
(function runMailScript(current, template, email, email_action, event) {
var grpmembers = new GlideRecord('sys_user_grmember');
grpmembers.addEncodedQuery('group=420ebf345893e100ac315518e955d88e'); //Replace with your group's sysid
grpmembers.query();
while(grpmembers.next()){
email.addAddress('cc', grpmembers.user.email.toString());
}
})(current, template, email, email_action, event);
Please Mark My Response as Correct/Helpful based on Impact
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 09:40 AM
Hi @NiloferS
I would recommend having DL group for the group members and the email to be set on the group email of group record
and use the below script in the mail script :
email.addAddress("cc","<email_address_of_the_Group>");
But still, you can proceed with manually adding a user using the script below
var grpmem = new GlideRecord('sys_user_grmember');
grpmem.addQuery('group','<sys_id of group>'); //Replace with your group's sysid
grpmem.query();
while(grpmem.next()){
email.addAddress('cc', grpmem.user.email.toString(),grpmem.user.name.toString());
}
Mark this as Helpful / Accept the Solution if this clears your issue