how to send notification for all change task group after completing change request in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team
Please suggest configuration to send notification for all change task assignment group members after completing parent change request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar
Thank you so much for your reply
i am able to store all users sysid in one flow variable with your help
but i am facing issue with 4 th point to store unique values could you please explain in brief
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Glad to know that my approach worked.
the 2nd flow variable will store unique users from array.
Something like this you can use "Set Flow Variables" flow logic once the For Each ends
var finalUsers = fd_data.flow_var.flowVariableName.toString().split(',');
var arrayUtil = global.ArrayUtil();
finalUsers = arrayUtil.unique(finalUsers);
return finalUsers.toString();
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @vamshi2 ,
I tried your whole problem in my PDI and it works for me please check below solution
I Create a event - "send.notification.when.request.closed"
After that I created a Notification that triggered when event is called
Create a before BR and add below script
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
gs.log("BR Called");
var groups = [];
var users = [];
var gr = new GlideRecord("change_task");
gr.addQuery("change_request", current.getUniqueValue());
gr.query();
while (gr.next()) {
groups.push(gr.assignment_group.toString());
}
var groupGr = new GlideRecord("sys_user_grmember");
groupGr.addEncodedQuery("nameIN" + groups);
groupGr.query();
while (groupGr.next()) {
gs.log("Inside while for users");
users.push(groupGr.user.toString());
}
gs.log("groups - " + groups);
gs.log("User - " + users);
gs.eventQueue("send.notification.when.request.closed", current, users.join(","), "");
})(current, previous);
Result:
Once I close this change_request it will send notification to all users of change task assignment group
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Sarthak Kashyap
Thanks for the reply
i am implementing using flow design as shown
it is working but it is triggering twice if user is part of two groups so please suggest
