How to send emails to all group members from sys_user_group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2022 09:15 AM
Hi,
There is one table in which there is a field "assignment group" which is referencing to "sys_user_group" and i need to send 4 same emails to group members mentioned in current group. Below is the email script written but still its coming empty in preview email. It should look like in email "Hi name(name of that group member)" for 4 users
var Arr=[];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('sys_id', 'current.group');
gr.query();
while (gr.next()) {
Arr.push(gr.user.name.getDisplayValue());
}
Can someone suggest some solutions.
Thanks in advance.
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2022 10:00 AM
Just to inform we cannot add users in TO in email script
It is only possible to add users in CC or BCC but not in TO
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2022 10:16 AM
Below is the complete email script and this email script i have called in body of the notification
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', current.group);
gr.query();
while (gr.next()) {
template.print("Hi: "+gr.user.name.getDisplayValue());
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2022 10:19 AM
Which table notification is on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2022 10:22 AM
Its in certification task table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2022 10:22 AM
You want to print the group members names on the Notification or you want to send the Notification to group members?
I am confused now
Murthy