- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2015 11:00 AM
Hi Friends,
I need to send a mail notification to some mail groups dynamically based on the condition.
I am not ready to create a mail id for my group.
But I need to get the mail ids of the group members.So that I can send them notification.
How to achieve this.Please advice
Thanks
Prici
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2015 03:53 AM
Thanks everyone for your time.
The following snippets did it..
var groupMemberMailIds = '';
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group.name','<group-name>');
gr.query();
while(gr.next()){
if(groupMemberMailIds != ''){
groupMemberMailIds += ',' + gr.user.email;
}else{
groupMemberMailIds = gr.user.email;
}
}
gs.log(' groupMemberMailIds are.....'+groupMemberMailIds);
Thanks
Chitra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2015 06:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2015 10:30 PM
Hi Andrew,
I should have explained more..
I need to do this in Business Rule through script.
Before calling the event I will get the current Assignment Group name.
Based on the Assignment Group name I need to send notification to a group users.
Anyway I know we can give a mail id to group.
But what I need to do is,I need to get the group member list and based on their name I need to get the mail id.
Then I can send the notification to them.
Hope it is clear now.
Thanks
Pricilla
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2015 05:38 AM
Pricilla,
You should be able to send to a group in a notification and ServiceNow should send to all members in the group assuming that there is no email address assigned for the group. So what if you trigger an event containing the group sys_id as parm 1 and the group name as parm 2 then have a notification send to parm 1 when the event is triggered?
Let me know if you have questions or that does not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2015 04:10 PM
Hi Pricilla - apologies,
Coding is not my specialty but are you able to dot walk along the following lines?
- You have the assignment group (sys_user_group) - Name Field
- Use this information against the group member table (sys_user_grmember) - Group Field
- Utilise a While statement to get all members
- For each member assigned to that group get the Email Field
- Add this email to the list
Hope this gets you closer to a solution
cheers