How to send emails to all group members from sys_user_group

Priyanka77
Tera Guru

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

29 REPLIES 29

Murthy Ch
Giga Sage

Hi Priyanka,

Can you try like this:

Go to the groups table and check the Include Members checkbox as shown below.

find_real_file.png

Hope it helps

 

Thanks

Murthy

Thanks,
Murthy

Thanks for your response.

This is not for particular one group instead it should work for all tables thats why i added group dynamically in script.

Okay got it.

Where are you writing this script exactly?

 

Thanks,
Murthy

In Email script

Okay and how are you returning it?

Can you share the complete code?

 

Thanks,
Murthy