- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2014 08:42 AM
I'm new to service now administration so please bare with me. I'm building a form and I need a few fields to autofill the information and its returning the user name as the sys_id not the string value. any help would be greatly appreciated
function onChange(control, oldValue, newValue) {
var name = g_form.getReference('application_name');
g_form.setValue('appowner', name.u_appowner);
}
the appowner field is populating the correct users sys_id but I need it as the actual name. Thank you in advance.
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2014 09:20 AM
Hi Chad,
if appowner is a reference field to the sys_user field then it will work as expected, else you will have to extract the user name from this name.u_appowner in the same was as you extracted u_appowner from application_name, ie using getReference.
a better approach will be that you pass application_name to a script include using glideajax and there you can directly extract the u_appowner and get the display value of u_appowner by using .getDisplayValue().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2014 09:05 AM
Try this:
var name = g_form.getReference('application_name').fieldname;
...where 'fieldname' is the field name of the User table where the name of the person is stored.
also, 'name' is widely used...I recommend 'myName' instead.
OR....try this:
var myName = g_form.getDisplayValue('application_name');
g_form.setValue('appowner', myName );

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2021 09:12 AM
Thanks! I used the below code to copy list collector values to a text box in order to include the variable in my flow designer email.
var myName = g_form.getDisplayValue('application_name');
g_form.setValue('appowner', myName );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2014 09:20 AM
Hi Chad,
if appowner is a reference field to the sys_user field then it will work as expected, else you will have to extract the user name from this name.u_appowner in the same was as you extracted u_appowner from application_name, ie using getReference.
a better approach will be that you pass application_name to a script include using glideajax and there you can directly extract the u_appowner and get the display value of u_appowner by using .getDisplayValue().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2015 09:17 PM
can you please provide us example with some code? i am experiencing similar issue