how to get user sub region if no variable name 'subregion ' available in given record producer

suryateja07
Tera Contributor
 
2 REPLIES 2

Tanushree Maiti
Tera Patron

Hi @suryateja07 

 

To get a user's sub-region by dot-walking, you must traverse through the user's Location (cmn_location) table, as the standard sys_user record typically only holds top-level location references rather than a direct "sub-region" field

 

e.g if you are looking for user city to be keep in sub region , you can take help from this sample script.

 

var gr = new GlideRecord('sys_user');
if (gr.get('USER_SYS_ID_HERE'))// Replace with actual user sys_id
{
var userCity = gr.location.city.toString();
gs.info('The user\'s city is: ' + userCity);
}

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Yes this will work but my question is I want to get sub region in client script to hide some of the options based on the condition.