Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Retreive username & role in a report
bcmp
<div>Much appreciated, if some one share the ways to retreive the username and role in a report design deployed in iHub</div>
Find more posts tagged with
Comments
jfranken
<p>This code will get you the name of the user when the report is run on the iHub server:</p>
<p> </p>
<p><span style="font-family:calibri, sans-serif;"><span style="font-size:11pt;">var username = reportContext.getAppContext().get("ServerUserName");</span></span></p>
Matthew L.
<p>Here is another way (Example attached):</p>
<pre class="_prettyXprint _lang-js">
//Returns Username as string
var userName = reportContext.getAppContext().get("ServerContext").getUserName();
//Returns UserRoles (UserGroups in iHub) as array
var userRoles = reportContext.getAppContext().get("ServerContext").getUserRoles();
</pre>
bcmp
<p>Great. Thanks</p>