Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 05:15 AM
Hi experts,
u_region is a reference field in user table with value Europe.
This reference field value is not working in this addQuery in scriptinclude.
Below is code snippet. Please let me know the what went wrong.
TIA
isEuropeVisible: function() {
var gr = new GlideRecord('sys_user');
//gr.addEncodedQuery('active=true^u_regionLIKEEurope');
gr.addQuery('active', true);
gr.addQuery('u_region.u_name', 'Europe');
gr.addQuery('sys_id', gs.getUserID());
gr.query();
if (gr.next()) {
return true;
} else return false;
Solved! Go to Solution.
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 05:25 AM
Hello,
Try passing Sys id instead of name.
isEuropeVisible: function() {
var gr = new GlideRecord('sys_user');
//gr.addEncodedQuery('active=true^u_regionLIKEEurope');
gr.addQuery('active', true);
gr.addQuery('u_region', 'sys id of europe');
gr.addQuery('sys_id', gs.getUserID());
gr.query();
if (gr.next()) {
return true;
} else return false;
Please hit like and mark my response as correct if that helps
Regards,
Musab
Regards,
Musab
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 05:25 AM
Hello,
Try passing Sys id instead of name.
isEuropeVisible: function() {
var gr = new GlideRecord('sys_user');
//gr.addEncodedQuery('active=true^u_regionLIKEEurope');
gr.addQuery('active', true);
gr.addQuery('u_region', 'sys id of europe');
gr.addQuery('sys_id', gs.getUserID());
gr.query();
if (gr.next()) {
return true;
} else return false;
Please hit like and mark my response as correct if that helps
Regards,
Musab
Regards,
Musab