Hexagon Geospatial
MENU

M.App Enterprise

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Contributor
Posts: 7
Registered: ‎09-28-2018
Accepted Solution

Get username of the current user

Hi,

 

I am working on a script at a custom panel and need to get the username of current user. I've tried session.username but no value returned. Any suggestion?

 

Thank you.

 

JL

Highlighted
Frequent Contributor
Posts: 143
Registered: ‎04-29-2016

Re: Get username of the current user

Hi Andthen,

 

To get user name of current user.. you can use {USER.NAME}

 

Regards,

Maha

Staff
Posts: 925
Registered: ‎10-18-2015

Re: Get username of the current user

in a browser application there are no variables like in Workflows or Desktop App. What you can do is to get information from the local stored token, something like:

 

var data = JSON.parse(window.localStorage.apps_storage);
console.log(data["userName"]);

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Occasional Contributor
Posts: 7
Registered: ‎09-28-2018

Re: Get username of the current user

Thanks Stefano, this way works for browser app.

 

JL

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Development Ticket through our Development Ticket Portal.