how to get the values of a list type field with background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2022 11:27 PM
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...
Thanks in advance...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 12:06 AM
can you type in the script here.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 12:15 AM
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());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 12:27 AM
user this : var abc = incidents.u_phone_number;
It will return the sys_id of records
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 12:27 AM
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"));
}
Murthy