Home
Analytics
Get Current User ID in Javascript
birt4bank
Hi,
I'm developing a report where we have to track the report's usage. Is it possible in javascript to pull back the current user id? I would then put that ID into a variable and pass it as a parameter into the database.
Any help would be appreciated.
Thanks
Find more posts tagged with
Comments
bgbaird
reportContext.getAppContext().get('ServerUserName')
bgbaird
Try this
--reportContext.getAppContext().get('ServerUserName')
birt4bank
Thanks! I'll give it a shot and see what I get.
bgbaird
If you are using Actuate iServer, you can set up usage logs to pick that up, then I use BIRT to report those csv files.
REPORT PATH and Name**
reportContext.getAppContext().get('VolumeName')+reportContext.getReportRunnable().getReportName()
Server User and Time**
today = new Date();
df = new Packages.java.text.SimpleDateFormat("MM/dd/yyyy hh:mm a");
today = df.format(today);
"Run by: " + reportContext.getAppContext().get('ServerUserName') + " @ " + today;
birt4bank
for some reason It's displaying 'Anonymous'. Is there a reason for that?
bgbaird
That will be the user displayed in the IDE unless you choose a "run as" option