- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020 02:03 PM
Hello,
We are on NewYork version. I have a need to find out about logged in user field value on client script (on INC table).
How can I get that information? Below is the custom field value I need in client script. (Service Type)
I am able to get user Id, but nothing beyond that.
Please advise.
Thanks,
Client Script on INC table.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020 02:22 PM
You don't have access to everything about the user client side. Given your script is an onLoad, you may be better off using a display business rule to set a g_scratchpad variable and utilizing that in your onLoad script. See the following article for an example:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020 02:27 PM
Assuming the database name of the ServiceType field is "u_servicetype", this should work:
var gr = new GlideRecord('sys_user');
gr.get(g_user.userID);
var svcType = gr.u_serviceType;
Note that this might have a slight UI delay since gr.get is doing a synchronous AJAX call. You can do it asynchronously with a gr.query and a callback function, as:
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',g_user.userID);
gr.query(function(user){
if(user.u_servicetype=="CMS"){
return;
} else {
// all the rest of your code...
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020 04:33 PM
Thanks Ben for your response.
For some reason, it wouldn't give me the value when I tried using above steps, but it's good to know alternative way. (Without making AJAX call)
Thanks,
Rajan