How to set assignment group based on logged in user region
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 07:39 PM
Hello,
I have logged into the incident form, my region is india, in Assignment group field it needs to show only india groups list.
If some x person logs in, he's region is empty, in that case it needs to show all the assignment groups list.
if some y person logs in. his region is london, in that case it needs to show only london assignment groups list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 08:02 PM
you can use advanced ref qualifier on the assignment group field using the Dictionary override
what did you start with and where are you stuck?
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
01-27-2025 09:13 PM
Hi @sriram7 ,
Follow below steps.
1. Go to dictionary override of assignment group. Add the reference qualifier.
javascript: "sys_idIN"+ new getMyGroup().getGrps();
2. create one script include name getMyGroup with function getGrps().
use below code.
var getMyGroup = Class.create();
getMyGroup.prototype = {
initialize: function() {},
getGrps: function() {
var userSysId = gs.getUserID();
var userCountry = '';
var userRecord = new GlideRecord('sys_user');
if (userRecord.get(userSysId)) {
userCountry = userRecord.country;
}
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('u_country', userCountry);
gr.query();
while (gr.next()) {
groupSysIds.push(gr.group.toString());
}
return groupSysIds;
},
type: 'getMyGroup'
};
3. create one filed called u_country in group table and map the country which they belongs to. Use save value like country filed on user table.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------