M.App Enterprise Discussions

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
Highlighted
Occasional Contributor
Posts: 8
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: 151
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

Maha Kamal
Highlighted
Staff
Posts: 1,098
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
Highlighted
Occasional Contributor
Posts: 8
Registered: ‎09-28-2018

Re: Get username of the current user

Thanks Stefano, this way works for browser app.

 

JL