- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 12:25 AM
Dear all,
I have define a notification which is trigger by an event.
I have then created a notification which will be fired by the event but I need to set the Who Will receive Group dynamically as it will depend on the context of the event
Q 1 : guess the idea is to pass the group sys_id as parameter to the event correct ?
Q2 : how can I set the group of the Who will receive of my notification based on the event parameter ?
Thanks for help
regards
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 06:13 AM
Good to know, can you mark my answer correct to close the thread down?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 12:57 AM
I believe the 'event parm1 contains recipient' field only works if you're passing through a user sys_id or an email address, worth testing with a group sys_id though.
Assuming the group sys_id doesn't work, the best way around it is to add the members of the group to an array and then pass that array of users through as event parm1.
var grp = current.getValue('assignment_group'); //or wherever you're getting the group from
var arr = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', grp);
gr.query();
while(gr.next()){
arr.push(gr.getValue('user');
}
gs.eventQueue('your.event.name', current, arr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 02:08 AM
thanks I will give a try and let you know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 05:20 AM
Passing group id as part of parmater 1 of event works fine.
By the way do you have any idea of this related post that I sumbit ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 06:13 AM
Good to know, can you mark my answer correct to close the thread down?