- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 06:01 AM
Hello team,
How can the location be automatically displayed by the user in the catalog item? What type do I have to add?
Many thanks
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 06:12 AM
Hi,
So you'd create a reference variable that points to the location table, then you can set the default value of that variable to be:
javascript:gs.getUser().getLocation();
Which will automatically place the location of that user in that field for you.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 06:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 07:25 AM
I cannot save the address in the user view. I am currently using the Paris Release in my instance. Does any of you have the same mistake? The address can be selected, but after saving the address is gone again.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 07:30 AM
Hi,
That's because the Location is dependent upon the Company. Here is the dictionary dependency tab within the location field showing that:
So you'd want to either remove company from that field and save...
Or...
Choose a location that has an appropriate relationship to the Company.
Meaning...right now, when you select a location, it's not related to the company set for the same user, so when you save, it gets removed.
Please mark reply as Helpful, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 06:35 AM
Hi,
Do you want currently logged-in user location? If yes then go with Allen's solution.
If you have user variable and you want selected user location then you need to have callback functionality in place or Client script and script include combination to fetch location and set to variable.
Thanks,
Dhananjay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2021 12:54 PM
Hi,
I'm trying to accomplish something similar.
Do you have an idea of what would need to change in this script for it to work?
https://community.servicenow.com/community?id=community_question&sys_id=d7b8d5461b667c90d46b62c4bd4bcbe8&anchor=answer_c70d1182db6274903dd13ca8f4961930