how to get the values of a list type field with background script

skumar_srbh
Tera Guru

I have a list type field on the form and I am trying to get the values of field via back ground script but getting null..  can anyone help to get the value...

find_real_file.png

Thanks in advance...

5 REPLIES 5

RaghavSh
Kilo Patron

can you type in the script here.


Raghav
MVP 2023

var incidents = new GlideRecord('incident');
incidents.addQuery('sys_id', 'f0bdf9051b910110fa9e8515ec4bcb1d');
incidents.query();
while (incidents.next()) {

var abc = incidents.u_phone_number.getValue();
gs.info("phone no:-"+abc);
gs.info("num"+ incidents.u_phone_number.getDisplayValue().toString());

}

user this : var abc = incidents.u_phone_number;

It will return the sys_id of records

 


Raghav
MVP 2023

Murthy Ch
Giga Sage

@skumar_srbh 

Can you try this:

var incidents = new GlideRecord('incident');
incidents.addQuery('sys_id', 'f0bdf9051b910110fa9e8515ec4bcb1d');
incidents.query();
while (incidents.next()) {
gs.info("NUmbers are:"+incidents.getDisplayValue("u_phone_number"));
}
Thanks,
Murthy