- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2020 04:50 AM
This is the first custom application attempted.
I would like to auto populate the value from the User [sys_user] department field, but I'm not quite sure how to do that. (Refer to attached screen print) I was able to successfully auto populate the Requestor field, but am having trouble with the Department field.
Perhaps the missing link for me is that I must somehow associate the Department field value with the Requestor's User ID. Unfortunately, I'm not sure how to do that.
So, I appreciate any help which can be provided!
Solved! Go to Solution.
- Labels:
-
User Experience and Design

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 05:28 AM
Taking the Incident form lay-out as example. You could add the field doltwalked like:
If I now select a User which has a Department, like on my PDI "HR" is my department, automatically the Department is shown:
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2020 05:04 AM
Hi,
Department in the user table is a reference to cmn_department. You can get the sys_id from the column in sys_user. You can set up your column in a custom app as a string or a reference. In most cases, the benefits of having it as a reference outweigh those of inserting a string and not having to do any relational look ups at run time.
You are able to insert the user directly because you can use g_user.userID. In order to get the department, you need to create an AJAX call to retrieve the value from the server. Here's the link to the documentation on AJAX.
On thing that many people miss is making sure that the server side script needs to be marked as client callable.
Hope that helps.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 05:06 AM
Hi how did you complete this requirement