- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 09:26 AM
I want to send notification to group manager only once if we added/removed number of users as group's member.
For example :
1. If i have added 4 users as group member then it should only trigger one notification to group manager and if added 4 more then also it should trigger one notification only.
2. If we removed 2 then also it will trigger one notification.(Right now its triggering for each user addition/deletion.)
Any help is appreciated.
Thanks,
Vinay
Solved! Go to Solution.
- Labels:
-
Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2020 01:00 PM
Yeah, I tried it without the time restriction, and still couldn't get it to not add the second event, or even change the State so that it didn't trigger the notification, so it's probably best to get rid of that business rule and let the events get added.
I hope I'm not leading you down another rabbit hole, but I stumbled upon something that seems to be getting us closer. In your business rule that is calling the event on deletion, change the call to this
gs.eventQueue('group.membership.delete', current, current.group.name, current.user.name, 'group.membership.delete');
That last parameter will put it into a queue so it won't process. Incidentally, without this I was seeing the event error out and the notification not trigger since it was trying to process on a record that no longer exists, which makes sense I guess. In any event, now we haven't done anything to trigger a notification, but we have captured each name (or ID, or whatever you want) that was deleted from each group, and the date/time stamp, so that seems like progress.
Does the group manager need to get the notification right away? If not, you could have a scheduled job that runs nightly against the sysevent table and pushes all of the names into an array for each group for that day, then calls a new event which is what would cause the notification to trigger. The scheduled job would change the state and/or the queue so that they don't get picked up the next time, so you could run it every hour or whatever and not mess with time ranges.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2020 12:30 PM
This is not an appropriate response.
You've done this twice now.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2020 05:21 PM
What problem are you trying to solve by spamming the group manager with emails? This seems like a solution to the wrong problem.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 07:55 AM
Whenever we remove any member from the group , we need to send email to group manager, but if we are removing chunk of user from group then we need only 1 email rather then multiple.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 05:17 PM
But why do you need to send an email to the group manager?
That is the technical solution to a problem, but what is the actual business problem?
If a person is no longer working in their team, surely the manager would be amongst the first person to know this?
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022