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:26 AM
I want to send notification to group members with their name in content of email(Only one notification created). It should be like:
Hi member1(email 1)
Hi member2(email 2)
Hi member3(email3)
Hi member4(email 4)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2022 10:34 AM
Okay got it.
You want to send separate notification to all of the group members with name dynamically?
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2022 10:40 AM
yes exactly. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 02:55 AM
Create a BR and put your conditions
Create event registry and call it from BR.
I have tried in my instance and it worked for me.
Sample code:
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group", current.getValue("assignment_group"));
gr.query();
while (gr.next()) {
gs.eventQueue("send_group_members", gr, gr.getValue("user"), gr.getDisplayValue("user"));
}
})(current, previous);
Hi member1(email 1) - For this get the parm2 value and use it Message HTML something like below syntax:
Hi, Use dollar symbol here{event.parm2} //taking this value from parm2 in BR
It will trigger the notification to all group members separately.
Hope it helps.
Thanks
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2022 10:25 AM
Hi,
Couple of things here as listed below:
1. Why do you need a script first of all? What is the exact Use Case, can you share here? Reason being you can simply select the field on your notification form itself as shown below.
2. Secondly, even if you go ahead with a Script approach your Assignment group is a single select or multiple select value field? Can you confirm?
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke