I want to send notification when n number of users added in a group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 07:07 AM
Hi All,
I have a requirement where I need to send two notifications. The first notification I want to send is when 45 members are added to a group and the second notification I want to send is when the 50th member is added to that group.
Adding group members is happening by workflow since it requires approval from admins.
Seeking the best and easy approach for this.
Thanks in advance,
Amol
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 11:36 PM
Hi @Amol Pawar ,
Please refer below script on sys_user_grmrember table
(function executeRule(current, previous /*null when async*/) {
var getUserMem = new GlideAggregate("sys_user_grmember");
getUserMem.addAggregate("COUNT");
getUserMem.addQuery("group",current.group);
getUserMem.query();
if (getUserMem.next()){
var countMem = getUserMem.getAggregate('COUNT');
if(countMem == 45){
//Trigger event
}
else if(conuntMem == 50){
//Trigger event
}
}
})(current, previous);
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 06:09 AM
Hi @Harshal Aditya ,
Thank you for your reply, it was helpful indeed. Below is my working script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 06:13 AM
Hi @Amol Pawar ,
Please refer below article
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0522706
Regards,
Harshal