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

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Should this be onLoad? onChange?
And is this Scoped app or Global?

Seeing your picture, also Platform UI, not Service Portal/Mobile?

You might be able to use a default value if this is onLoad. If onLoad and Scoped, you could set Scratchpad through Business Rule, and obtain it with Client Script. If onChange, you could use a Client Script + Script Include. See this article which I wrote a few weeks back which contains detailed examples:
Client Side Scripting: Go for GlideAjax (with getXMLAnswer)!

Also if doing this onChange, Client Script + Script Include. Go for GlideAjax with getXMLAnswer, by far better than getReference or GlideAjax with getXML.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi, 

It's a global mobile function.

I got this condition script box that i can call a script include, but i wonder if i can do it with a getUser.

find_real_file.png

Hi,

the condition looks fine

Regards
Ankur

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

Hi Ankur, that was a testing condition. What i need is get user location