- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 03:20 AM
Hi,
I want a task to be done. When the caller is creating an incident record, I want the assignment group to be dynamically populated with the assignment group of the caller. How to do this? Please provide the code
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2025 09:42 PM
I believe I shared solution using business rule.
You can use onChange and glideajax and use similar logic and set the group
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 05:36 AM
Hi @NishaB
Don't take me wrong, but it is not a valid use case also, if you need to change the assignment group then it will increase the reassignment count without any valid reason. Try to analyse the %age that the populated assessment group is right to solve this issue.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 04:09 AM
what do mean by assignment group of caller?
What's your business requirement here?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 05:07 AM
If the caller is a service desk agent, he will be a member of an assignment group. So I want that assignment group to be dynamically populated if the service desk agent i.e. caller is raising the incident. If the caller is not part of any assignment groups, then it is okay, we can leave the assignment group field as empty. If the caller is part of multiple groups, then automatically populate the assignment group field with any of the assignment groups.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 05:32 AM
then use before insert BR with condition as caller is not empty
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var groups = new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.caller_id.toString()).getMyGroups());
if (groups.length > 0) // if more than 1 group then set 1st group as assignment group
current.assignment_group = groups[0];
else if (groups.length == 1) // if only 1 group then set that group
current.assignment_group = groups[0];
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 06:13 AM
Thanks for the code. I checked it in my PDI. It is working because the assignment group is not mandatory. So after saving the record, the assignment group is auto-populating. But I want to do this is in my dev environment where the assignment group is mandatory. So I want the assignment group to be automatically filled as soon as I enter the caller and before saving the record