We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Get user location with getUser

Joao Carlos1
Tera Guru

Hi,

How can i get the location of the login user with getUser and get the location? Can it be simple to add to a condition script? I need the condition like, if get user location is Peru

 

find_real_file.png

 

find_real_file.png

 

Thanks in advance,

Joao.

7 REPLIES 7

Hi,

so use this to compare the location

gs.getUser().getLocation() == 'locationSysId'

if my answer helped you, kindly mark it as Correct & 👍Helpful based on the Impact.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Mike Patel
Tera Sage

you can use something like in condition

gs.getUser().getLocation() == 'SYS_ID_of_location';

if you want just location than use (below will give you sys_id of location)

gs.getUser().getLocation();

 

Refer to below for more info functions

https://www.servicenowguru.com/scripting/user-object-cheat-sheet/

Not applicable

Hi,

How to get the location not sys_id.