Set Display Value on Catalog Client Script - not sys_id

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 01:49 PM
I have this client script that's running when ever a serial number is changed. What I'm looking for is to set the model name to the text field. But the scipt returns the sys_id instead of the Dispaly value.
I've seen some posts here but I'm missing the last piece to understand.
Here's my Catalog UI Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var grSerialNumber = new GlideRecord('cmdb_serial_number');
var snSysID = g_form.getValue('serialNR');
grSerialNumber.addQuery('sys_id', snSysID);
grSerialNumber.query(myCallbackFunction);
g_form.addInfoMessage(snSysID);
function myCallbackFunction(gr) {
while (gr.next()) {
//set Display Value to model filed
g_form.setValue('model', gr.cmdb_ci);
}
}
}
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 02:33 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 02:39 PM
That's great! I'll give it a go tomorrow but I'm sure this is the way to go!
I'll keep you (the thread) posted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2020 10:46 PM
Hi Henrik,
Did this resolved your question?
If not, please let us know how we can be of further assistance.
Kind regards,
Willem