In service portal, how to show current loggedIn user Location and Temperature
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 02:43 AM
In service portal, how to show current loggedIn user Location and Temperature
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 04:33 AM
Hi,
I want to show the location name from where the user is loggedIn on the service portal..
can't we use any geo location? or any other way to show this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 04:54 AM
You can display User Location, but that data need to be present in your Location or some pther table from where you can query and then display it.
Do you have that data available in some table in your instance?
If yes then you need to update the code as below:
Server:
getUserDetails();
function getUserDetails(){
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',gs.getUserID());
gr.query();
if(gr.next()){
data.Name = gr.name;
data.Location = gr.getDisplayValue('location');
}
}
HTML:
<div>
<span>{{data.name}}</span>
<span>{{data.Location}}</span>
</div>
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 06:10 AM
Hi Sathwik,
you cannot get the location from where user logged in directly from ServiceNow
you can try to use javascript browser code but you need to play with that
in client side add the code; check this for help
https://stackoverflow.com/questions/35267562/how-to-get-my-current-location-on-my-browser
to get temperature you can use some API call which accepts latitude and longitude
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2022 11:16 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader