g_form.getDisplayValue('u_student') is not working in client script in “Xanadu” version

abhisekransingh
Tera Contributor

i have a onload client script and i am retriving displayvalue  of a refernce field('u_student).But it is not working.

 

function onLoad() {
//Type appropriate comment here, and begin script below

var stu_value=g_form.getDisplayValue('u_student');
alert(stu_value);
 
 
}
7 REPLIES 7

dgarad
Tera Sage

Hi @abhisekransingh 

Client GlideRecord object does not support getDisplayValue() function... It would only be supported when it runs on gliderecord object at server side.

Not applicable

Hi @abhisekransingh ,

use this:

(g_form.getDisplayBox('u_student').value);

 

@Community Alums both getDisplayBox() and getDisplayValue()  both are not working ,Even both are not showing in code suggestion.

vennelasai
Tera Contributor

Hi @abhisekransingh 

 

Please use below code to get the value, it works only your field type is reference.

Here I am taking an example called field on incident form,

var student = g_form.getReference('caller_id');

alert('student.user_name');

 

Please replace caller_id with your field name

 

Please mark it as correct/helpful If it works for you.

 

Thanks,

Vennela