
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 06:31 AM
I'm trying to use a document ready function in a UI Script to capture the current user...
var $j = jQuery.noConflict(true);
$j(document).ready(function () {
user = gs.getUserID();
alert(user);
});
This doesn't work.
Has anyone used a document ready function in a UI script or an equivalent that has worked.
Failing that can anyone tell me how I can get the current user in a UI Script?
Solved! Go to Solution.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2015 02:53 AM
UI script sometimes doesn't have access g_user object .. Do a glideajax and return gs.getUserID from the script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 06:50 AM
Hi,
Please try the client side expressions
var userName = g_user.userName;
alert('Current user = ' + userName);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 07:12 AM
Var usr = "${gs.getUserID ()}";
alert (usr);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 08:02 AM
I have used document ready function in couple of UI pages.. Works just well. The only error I notice here is
gs.getUserID(); which is a server side function.. Make use of the equivalent client side object and that should work just fine ...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 08:44 AM
I've tried using g_user.userID but I get an undefined.
This is purely a UI script that act's upon the 'nav_header_stripe_decorations' element (the top banner).
Just wanted to clarify I'm not using a UI Page (otherwise I would have used jelly to solve this, which I've done before)