- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2019 08:42 AM
Hello experts, I am creating a catalog item in which there is some information that needs to be loaded with any user when opening the form, could you guide me on how to retrieve any user:
*Employee Number
*Department
*Position
I have a client script in which I get the user's "user name" which is this one:
Field has been set as a single line text:
those two are working but for the other fields (Employee number, Department, position) something is not working fine, could you be so kind of guiding me?
Thank you!
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2019 01:35 AM
OK well that is a good start, you are getting the sysid. So that is what DepartmentID is
If you now change that to say
javascript: gs.getUser().getDepartmentName();
That should return the name of the department
As you say these will auto populate the fields on load, which is a good thing to have. I use them a lot in my catalog items, make life easier to users.
But as you say someone might be logging a request on behalf of someone else.
You need to then just add these either into one total client script, or if you have the UserName one working, just copy them out into three.
1) Username on change
2) Department on change
3) Title on change
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2019 08:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2019 09:12 AM
So the getUserName() works because it is a GlideRecord in the system.
Try this to see if it returns the Department
javascript: gs.getUser().getDepartmentID();
Then hopefully this will work to get their job title
javascript: gs.getUser().gettitle();
If memory serves this use to not work, but I think it does now as you can dotwalk through the getUser() Gliderecord to call other fields from the User table/record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2019 09:44 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2019 01:35 AM
OK well that is a good start, you are getting the sysid. So that is what DepartmentID is
If you now change that to say
javascript: gs.getUser().getDepartmentName();
That should return the name of the department
As you say these will auto populate the fields on load, which is a good thing to have. I use them a lot in my catalog items, make life easier to users.
But as you say someone might be logging a request on behalf of someone else.
You need to then just add these either into one total client script, or if you have the UserName one working, just copy them out into three.
1) Username on change
2) Department on change
3) Title on change