- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 05:25 AM
writing a script include that it should only display assigned to fields which are same as to caller field location, assigned to field should only display the records which has same location as caller.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 05:49 AM
Hi @shaafi9631 ,
did you add it in the dictionary override?
it's for the incident table assigned to field only right?
open the dictionary override record of the assigned to field
and add it
don't wanna keep the existing ref qual conditions?
if you want to keep the existing condition and extend this addition filter use this
else use the ref qual I share in the ref qual directly
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 06:28 AM
Hi @shaafi9631 ,
sure update your script include as
var getHardwareUser = Class.create();
getHardwareUser.prototype = {
initialize: function() {},
user: function(userid) {
var userGr = new GlideRecord("sys_user");
if (userGr.get(userid)) {
return 'location=' + userGr.getValue('location');
}
return '';
},
type: 'getHardwareUser'
};
and ref qual as
javascript:new getHardwareUser().user(current.caller_id);
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 05:52 AM
Script Include:
var GetUsersByCallerLocation = Class.create();
GetUsersByCallerLocation.prototype = {
initialize: function() {
},
getUsers: function(callerId) {
var userList = [];
var callerGR = new GlideRecord('sys_user');
if (callerGR.get(callerId)) {
var callerLocation = callerGR.location;
if (callerLocation) {
var userGR = new GlideRecord('sys_user');
userGR.addQuery('location', callerLocation);
userGR.query();
while (userGR.next()) {
userList.push(userGR.getUniqueValue());
}
}
}
return userList.join(',');
},
type: 'GetUsersByCallerLocation'
};
Reference qualifier:
javascript:GetUsersByCallerLocation.getUsers(current.caller_id);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 06:00 AM
Updating reference qualifier:
javascript: new GetUsersByCallerLocation.getUsers(current.caller_id);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 05:55 AM
the field on which you are applying is on which table?
this should work ideally
javascript:'location=' + current.caller_id.location.sys_id;
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