- 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 09:20 AM
You would use gs.getUser(). For those other fields, if .getRecord().getValue() works, I would try that. An alternative method is to try a GlideAjax. For this in particular, a user wouldn't usually change unless they're an admin, so it would be okay to leave it on an onLoad. If it's not changing switching between impersonating users when you're testing, you should be reloading the form.
Hope this answer helped or solved your problem. If so, please mark as 'Helpful' or 'Correct'. Thanks!
Alexander
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2019 10:05 AM
Hello Alexander, I tried the get value but all I get is the department ID, and I need it to show the name, not the id. let me keep trying. As for the client script, I need it on change since users create tickets on behalf of other users, that's why I need to get the value of the user selected in "Requested for".
Regards