business rules ITSM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2024 10:48 PM
There is a requirement that in incident form whenever we are changing the assignment group if any member is available in that group, set work notes that Group member available and if no group member found then set worknotes No group member available.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2024 11:20 PM
what did you start with and where are you stuck?
you can use GlideAjax for this
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2024 12:12 AM
Hi @HarithaP
You can do this with the help of Before Insert/Update Business rule. Set condition to Assignment Group is not empty and Assignment Group changes Here's the outline of the script-
var assignGroup = current.assignment_group.toString();
var memGr = new GlideRecord('sys_user_grmember');
memGr.addQuery('group', assignGroup);
memGr.query();
if (memGr.hasNext()) {
current.work_notes = "Group member available";
} else {
current.work_notes = "No group member available";
}
Please mark my answer helpful and correct.
Regards,
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2024 12:23 AM
Hi @HarithaP ,
I tried your problem in my PDI and it works for me please refer below code
var gr1 = new GlideRecord('sys_user_grmember');
gr1.addQuery('group', '8a4dde73c6112278017a6a4baf547aa7');
gr1.query();
while (gr1.next()) {
gs.print("USER = " + gr1.user.getDisplayValue());
}
var getUserActiveGR = new GlideRecord('sys_user');
getUserActiveGR.addQuery('sys_id', gr1.user);
getUserActiveGR.addActiveQuery();
getUserActiveGR.query();
if (getUserActiveGR.next()) {
gs.print("getUserActiveGR = " + getUserActiveGR.sys_id);
current.work_notes = 'User is available = ' + getUserActiveGR.first_name + getUserActiveGR.last_name;
}
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak