- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 09:18 PM
Hi all,
I am new to service now and have been exploring the platform. I wanted to know if there was a way to access a variable called 'company' present for every user, using the g_user method.
Regards,
Vivek
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 09:24 PM
Hello Vivek,
Nothing OOTB at the client side. However at server side you can get the current logged in user's company sys_id as
gs.getUser().getCompanyID()
http://wiki.servicenow.com/index.php?title=Getting_a_User_Object#gsc.tab=0
You can create a script include and return back the response at client side with the usage of GlideAjax. More info here.
http://wiki.servicenow.com/index.php?title=GlideAjax#gsc.tab=0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 09:22 PM
When you say variable? you have a variable referenced to sys_user table and from here you want to fetch the company?
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 10:23 PM
Hi Harish,
Yes, each user from the sys_user table has a company.
Regards,
Vivek

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 09:24 PM
Hello Vivek,
Nothing OOTB at the client side. However at server side you can get the current logged in user's company sys_id as
gs.getUser().getCompanyID()
http://wiki.servicenow.com/index.php?title=Getting_a_User_Object#gsc.tab=0
You can create a script include and return back the response at client side with the usage of GlideAjax. More info here.
http://wiki.servicenow.com/index.php?title=GlideAjax#gsc.tab=0