pulling Region is corporate information
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2024 05:17 AM
i have a catalog item which contains a variable corporate_access (type: Yes/no) , what im trying to achieve is when the logged in user who is going to request the catalog item is from a corporate region it should show the corporate_access variable but if the user is not it should be hidden.
on the u_regions table there is a checkbox (u_corporate_region) which determines if its a corporate region or not.
i created a script include and a client script, what am i doing wrong here ?
Client script:
Script include:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2024 10:15 AM
@Jean-Paul de Ha Your script in the script include is incorrect due to which your code is crashing on line number 8 of your script include.
I am assuming you have a u_region reference field on your sys_user record and you would like to check if it is a corporate region or not. You can check the same via following script.
getRegion: function() {
var glideUser = new GlideRecord('sys_user');
var answer = '';
if (glideUser.get(gs.getUserID())) {
if (glideUser.u_region.u_corporate_region == 'true') {
answer = 'true';
} else {
answer = 'false';
}
return answer;
}
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2024 12:26 AM
@Sandeep Rajput no there is no region field on the sys_user record, the u_regions table has a field called u_corporate_region thats the field that determines if its a corporate region or not