
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 08:00 AM
I was wondering if anyone has had any luck in populating a user's department from the user table and also allow for that department to be updated if the Requested For field is changed to another user if submitting on behalf of another employee?
I have it working by using the default value from the variable field I created that will reference the department using code I found from previous discussions on the community but I want it to work the same way if you put in a request on behalf of another user. Right now it only pulls my info and if I place another user in the Requested For field it keeps my department without updating to that users department.
This is what I have in the default value as of right now of my custom variable:
javascript:gs.getUser().getRecord().getValue("department");
javascript:gs.getUser().getRecord().getDisplayValue("department");
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 08:40 AM
ok, then have your GlideAjax in your onChange client script pass the value from the Requested For field...then have your script include do a GlideRecord query so the sys_user table to lookup the department field for that user to pass back to the client script. let me know if you need help with the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 08:27 AM
Yep Terry, like Prateek is suggesting...use GlideAjax in an onChange client script with a script include to achieve this. Is the user's "Department" field populated on the sys_user table for all your user's?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 08:33 AM
Yes it is located on the user table and populated when the user is added to the system from LDAP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 08:40 AM
ok, then have your GlideAjax in your onChange client script pass the value from the Requested For field...then have your script include do a GlideRecord query so the sys_user table to lookup the department field for that user to pass back to the client script. let me know if you need help with the script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 08:42 AM
Thank you Patrick! I will reach out to you if I need assistance with the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 08:43 AM
excellent Terry, glad to help!