- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 11:49 AM - edited 10-12-2023 11:49 AM
Hi,
I am trying to create a Recipient List for Targeted Communication which should have recipients from a user group "xyz".
Can you suggest how to achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 12:08 PM
You can use script type to add users from a group to recipient list, provided the group members are one of the entity like contact, company/account, consumer, and internal user
Follow the steps:
1. Select Dynamic Condition in the Method field on the Recipients List form
2. Enable the Show Script check box.
3. Then create your script in the Script field to return array of sys_ids.
var memGr = new GlideRecord("sys_user_grmember");
memGr.addQuery("group.name", "Your GROUP NAME");
memGr.query();
var members = [];
while(memGr.next()){
members.push(memGr.user + '');
}
return members;
Please mark my answer helpful and accept as solution if it helped you 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 12:08 PM
You can use script type to add users from a group to recipient list, provided the group members are one of the entity like contact, company/account, consumer, and internal user
Follow the steps:
1. Select Dynamic Condition in the Method field on the Recipients List form
2. Enable the Show Script check box.
3. Then create your script in the Script field to return array of sys_ids.
var memGr = new GlideRecord("sys_user_grmember");
memGr.addQuery("group.name", "Your GROUP NAME");
memGr.query();
var members = [];
while(memGr.next()){
members.push(memGr.user + '');
}
return members;
Please mark my answer helpful and accept as solution if it helped you 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 08:24 PM
Thank you @AnveshKumar M.
I just changed the script - members.push(memGr.user + ''); to members.push(memGr.user.sys_id + '');
and it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 08:26 PM
@Apurva Jogal that's quick fix 👍
Thanks for sharing this info so that future readers can benefit from this.
Anvesh