Get the value of reference field using glideajax

SNow35
Giga Guru

How to get the display value of reference field in script include and use it in client script. I have done it using getdisplaybox but it is not supported or throws an error in some places, hence would like to do it through glideajax.

Thanks in advance.

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use g_form.getReference() with call back method to dot walk and get the field value which is display

but what error you are getting for getDisplayBox() can you share that?

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Can you provide a sample script?

Hi,

consider you have caller_id field which refers to sys_user table and you want to get the display value for this i.e. name you can have something like this

var callerName = g_form.getReference('caller_id').name;

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sudesh Ram
Kilo Contributor

Try with getDisplayValue() method