Display sys_user.manager in a field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2013 07:44 AM
Hi all,
I'm creating a Vacation App and trying to populate a field called manager from sys_user table. This field is actually the sys_user.manager of a current user that is login. I'm not that good in scripting and still confuse on whether to create a business rule or client script. What I'm assuming is to write a business rule since I need to access a sys_user table from the server. Appreciate any help on this.
Thanks a lot in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2013 08:05 AM
You'll first need to add a reference field to sys_user on the form, give it a default value (in the Dictionary) of the following to populate it with the logged in user:
javascript:gs.getUserID()
Then add that field's dotwalked Manager field to the form. I think you could even hide the reference field if it's confusing, leaving only the manager field. You should probably make the manager field read only with a UI Policy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2013 08:55 AM
Hi, I've added the "javascript:gs.getUserID()" in the Dictionary as the default but still wondering how and where am I going to populate the field sys_user.manager? My apologies, I'm really trying to learn ServiceNow.
Thanks again for your patience.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2013 09:21 AM
Hey no worries! We've all been there 🙂
Here's how you can add a field from a referenced record:
http://wiki.servicenow.com/index.php?title=Displaying_Information_from_Other_Records
If the article at the link's not quite clear enough, just follow up here. We'll get you there.