sys_created_by (USER ID) to Name in script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2011 09:33 AM
Hi All,
The sys_created_by field when creating an incident returns the USERS ID which for us is employee number. How could I convert this to their name?
s.setParameter('sys_created_by', current.sys_created_by);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2011 09:58 AM
You are probably looking for the getDisplayValue() function:
http://wiki.service-now.com/index.php?title=GlideRecord#getDisplayValue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2011 10:07 AM
The sys_created_by field references the user name field. In my situations the username field is our EmployeeID. I would like to somehow convert the employee ID to display the First Name and last name of the user.
I am not exactly sure how to access the sys_user table from the sys_created_by object and reference the first name and last name. Does this make sense? I was thinking something like:
current.sys_created_by.setDisplayValue(current.sys_created_by.sys_user??) not exactly sure how this works in sn.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2011 10:13 AM
It's probably not a good idea to be changing the 'sys_' field values from their defaults. I have a feeling you'd end up with some unintended consequences of doing so. For task records you can use the 'Opened by' field if you need to and for everything else that records history you can see the true user name in the history of the record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2011 10:21 AM
Thanks for the replies I appreciate this. I will explain a little more about what I am doing.
We have two production instances in our setup. I used SOAP messaging to send incidents (if the condition is met) from once instance to the other. Say I create an incident on instance A, it will be created with the INC number on instance B. I can update from A and have it update on B etc... What I am trying to do is map out the sys_created_by field from instance A to be placed into the opened_by field on instance B. I am not trying to change the values of a 'sys_' field. I am wondering if using the sys_created_by record, which in our case is user ID(1231234), I could someone use a script to change the user ID(which is the display value) to user Name.
Thanks!
Tony