g_form.getDisplayValue('u_student') is not working in client script in “Xanadu” version
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 06:57 PM
i have a onload client script and i am retriving displayvalue of a refernce field('u_student).But it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 10:33 PM
Please use below code,
I am taking reference id caller field on incident form. Please replace as per your requirement.
var student = g_form.getReference('caller_id'); //works only your field type is reference
alert(student.user_name);
Please mark it as correct If this helps you.
Thanks,
Vennela
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 10:49 PM
Hi @abhisekransingh
use the GlideAjax or GlideReocrd or g_form.getDisplayBox('u_student').value(this might not work in portals)
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 10:50 PM
Hi @abhisekransingh ,
getDisplayValue() won't work in client scripts. Also, you will find some API that are not showing because maybe ServiceNow has not documented it but it will work and fulfill your requirement.
In ServiceNow Docs you can find the API:
Try the below:
var stu_value=g_form.getDisplayBox('u_student').value;
alert(stu_value);
Mark this as Helpful / Accept the Solution if this helps.