Auto Populate First Name and Last Name when" Opened By" is Entered in an Incident Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2013 03:55 AM
We have "opened by" field in Incident Form. Next to it is a Reference Icon,which when hovered gives us details like First Name , Last name etc.
I personalised the Incident Form and added new fields - First name and last name and referenced them to Sys_User table.
What i want is that when " opened by " field is entered, the values for first name and last name should be filled up automatically. I went through wiki and found out that i may have to use business rules but i am not getting it properly. I am quite Fresh to ITSM/ServiceNow.
Any help would be great!
Thanks 🙂
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2013 07:02 AM
Hi Azfar,
Please use the below script in onchange of opened_by value.
Create First Name, Last Name as Text field.
function onChange(control, oldValue, newValue, isLoading)
{
fetchCallerInfo(control);
}
function fetchCallerInfo(control)
{
try
{
L_user_sys_id = control.value;
var L_first_name ="";
var recSet_sys_user = new GlideRecord('sys_user');
recSet_sys_user.addQuery('sys_id', L_user_sys_id );
recSet_sys_user.query();
while(recSet_sys_user.next())
{
L_first_name = recSet_sys_user.first_name;
//alert(L_first_name);
}
g_form.setValue("u_first_name",L_first_name);
}
catch(e)
{
return;
}
}
Hope it helps..:)
Lokesh O
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2013 06:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2013 07:40 AM
Azfar,
There is a very simple way to do this. Personalize your form and expand the Opened By reference field to add the opened_by.first_name and opened_by.last name fields to the form. When you do this, those fields will show up as readonly and will be auto-populated based on the opened_by value.
My take on this, however, is that if your users can see this information from hovering over the reference field icon, then why add it to the form? This adds to the complexity of the forms (number of fields) as well as the client-side performance. Adding one or two fields this way isn't a big deal, but it starts to add up once you decide to do this for other reference fields on the form as well. Make it a point to train your users on getting additional details from a reference hover and then your forms will be simple and elegant!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2013 04:05 AM
Thanks Jacob.
I am just fiddling with ServiceNow. I am trying to explore different possibilities. I will make sure that i avoid doing it when i am doing something live 🙂