- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2014 04:19 AM
Hi,
In a UI page, I need to check whether any user is currently logged in or not. I tried the below things to retrieve the details for checking,
1) I tried using g_form.userName in the client section of the UI Page. But i didn't get the user name.
2) I also tried in the Processing Script section by using the gs.getUserID() and tried to log the result. However here too i'm unable to see user name.
Can anyone please suggest, how should i try to retrieve current user details from a UI page?
Regards,
Kamal
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2014 01:31 PM
For future reference if you need to actually get the username of the logged in user, one way to do it is use ${gs.getUser().name} or other properties like:
${gs.getUser().name} // same as username
${gs.getUser().firstName}
${gs.getUser().lastName}
${gs.getUser().fullName}
${gs.getUserID()}
Putting this in your example you gave earlier you would replace "g_user.userName" with "${gs.getUser().name}". Make sure you include the quotes.:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<html>
<head>
<script>
function myFunction()
{
alert('Hi');
var usr = "${gs.getUser().name}"; //remember quotes are still needed
alert('Bye ' + usr);
document.getElementById('user').innerHTML = usr;
}
</script>
</head>
<body onload="myFunction()">
<div id='user'></div>
</body>
</html>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2020 07:53 AM
It works. Thanks