- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2018 05:02 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2018 05:22 AM
HI,
I have some different question? Where exactly you want to do this?
If its a client side then i will suggest you to use GlideAjax and script include.
If its a Business rule i will tell you to do either do dot.walking or use gs.getUser.getManagerID()
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2018 05:16 AM
I can't remember where I got this on the old Wiki site, and it should live out on the Docs site somewhere too:
myUserObject.getUserID() -- returns UserID of current user
myUserObject.getFirstName() -- returns first name of current user
myUserObject.getLastName() -- returns the last name of the current user
myUserObject.getFullName() -- returns the current user's full name
myUserObject.getDisplayName() -- returns the current user's display name, typically the same as full name
myUserObject.getEmail() -- returns the email address of the current user
myUserObject.getMobileNumber() – returns the mobile number of the current user
myUserObject.getDepartmentID() -- returns the sys_id of the current user's department
myUserObject.getCompanyID() -- returns the sys_id of the current user's company
myUserObject.getCompanyRecord() -- returns the current user's company GlideRecord
myUserObject.getLanguage() -- returns the current user's language
myUserObject.getLocation() -- returns the current user's location
myUserObject.getCountry() -- returns the current user’s country
myUserObject.getManagerName() -- returns the user_name of the current user’s manager
myUserObject.getManagerID() -- returns the sys_id of the current user's manager
myUserObject.getDomainID() -- returns the domain ID of the current user
myUserObject.getDomainDisplayValue() -- returns the domain display value for the current user
myUserObject.getTZ() -- returns the timezone of the current user
myUserObject.getUserRoles() -- returns the roles explicitly granted to the current user
To query the manager, write something along the lines of:
javascript:gs.getUser().getManagerID();
or
javascript:gs.getUser().getManagerName();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 01:20 AM
javascript:gs.getUser().getManagerName();
it's not working in my default section
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 11:40 AM
How are you attempting to use this? Depending on the method used, there may be some slight variation in the script needed.
This is a simple Display Business Rule that you could use for testing:
(function executeRule(current, previous /*null when async*/) {
var me = gs.getUser().getDisplayName();
var who = gs.getUser().getManagerName();
gs.addInfoMessage("Manager is " +who+ " employee is " +me);
})(current, previous);
It will provide an info message with both the current user (you) name and their manager's name when you view a record on the appropriate table (that the BR is running on).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2018 05:20 AM
Hi,
As these things have got discussed many times and are the basics of Servicenow so,instead of asking same queries kindly,first search and if any issues then post on community.
But,for now you can use :
gs.getUser().getManagerID() //on server end to get the logged in user's manager ID
//Using glide
var gr =new GlideRecord('sys_user');
gr.addQuery('active','true');
gr.query();
if(gr.next()){
var man =gr.manager;
}
REGARDS<
Munender