How to hide one field based on the user's Location?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 09:21 PM
Hi All,
I have a requirement that basically i have one record producer, in that i have one variable set, in that , three fields, "subject person, leave type and period", , so my requirement was that the field 'leave type' was only visible , when the users with location (WA or SA),
So please help me to achieve this
Thanks
Ramu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 06:42 AM
You can place the alert(info); before if logic and check what values your getting.
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 06:46 AM - edited 10-03-2023 06:54 AM
i put the alert , so its getting "null " value only, basically here i want to check the "state" of the location
i have tried user.location.state

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 06:48 AM
Share your script include and client scripts code
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 07:04 AM
Script include

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 06:33 PM
Hi, Please add the logs like below and see what is happening and also ensure there is valid value in location's state field,
getLocation: function() {
var userID = this.getParameter('sysparm_user');
gs.info("userID==>"+UserID); // check in log if this is valid UserID
var returnID = '';
var user = new GlideRecord('sys_user');
user.addQuery('sys_id', userID);
user.query();
if(user.next()) {
returnID = user.location.state;
gs.info("returnID==>"+returnID); // check in log if there is a state value present, if null check location table
}
return returnID;
},
type: 'Locationbased'
});
Harish