I have to get User's location state value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 03:06 PM
Hi,
I have to get User's location state value.
I have User's table and from User's table I have to get User's location and then state value in script.
Below is attached screenshot :
In above screenshot I'm getting current logged in User and then I'm querying that in hr profile table and then I'm retrieving entCode and empClass from HR profile table and if that condition satisfy then after that I'm setting groupingName.
In same way I need to query User's location and get state field value and if state is AB then I need to set groupingName.
Can anyone please help me to achieve that.
Regards,
Nivedita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 03:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 04:17 PM
Hi @Mike_R,
Thank you for your reply.
I have to query if Current user's location state is AB.
ex - You are logged in currently and if your's location state is AB then set groupingName ABC.
How I can check that.
Can you please help me with script.
Regards,
Nivedita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 04:29 PM - edited 10-05-2023 04:29 PM
var userLocation = gs.getUser().getRecord().getValue('location') ;
var location = new GlideRecord('cmn_location');
location.get(userLocation);
var state = location.state;
if(state == 'AB'){
groupingName = 'ABC';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 05:20 AM
Hi @Mike_R,
This code is not working.
I'm getting error.
Please find attached screenshot :
Please correct me to achieve that.
Regards,
Nivedita