how to get original value instead of sys id

Vikram Meena
Giga Contributor

Hi,

I am using getReference on catalog client script and also getting value fine but one of value i am getting is sys id but i want its text value ie display value not sys id . i use getDisplayValue() or display box but nothing is working 

code look like..

var caller = g_form.getReference("variables.user",callback);

function callback(caller){

var location = caller.location;// getting sys id  

// Need to change this sys id into display value format

g_form.setValue("variables.location",location);

}

 

Thanks in advance

10 REPLIES 10

Yash Agrawal1
Tera Guru

Hello Vikram,

Did you tried

var location = caller.location.getDisplayValue();

Hello Yash,

Yes i tried it but not works

@Vikram Meena 

You can only dot walk once in the getReference.

in order to get the display value or more dot walking you should use onChange client script with GlideAjax approach

refer example below

Client Script and glide ajax

Regards
Ankur

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

Dhananjay Pawar
Kilo Sage

Hi,

Using callback function you can perform only one level dot walking thats why it will give only sys_id.

You can use client script and script include combination.

Thanks,

Dhananjay.