- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 08:20 AM
I am trying to retrieve the Model id and the Manufacturer from the cmdb_ci_computer table in a scope application (x_g_lme_ham_classi.getComputerFields).
I have the following script include and client script. Problem not able to retrieve the values to display them in a catalog item. Also getting “There is a browser Javascript error in your console” Any suggestions! Your collaboration and guidance will be appreciated.
Script Include:
var getComputerFields = Class.create();
getComputerFields.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
getcmdb_ci_computerFields : function() {
var serial_number = this.getParameter('sysparm_serial_number');
var standardFields = new GlideRecord('cmdb_ci_computer');
standardFields.addEncodedQuery('serial_number='+serial_number);
standardFields.query();
if(standardFields.next()) {
return standardFields.manufacturer.getDisplayValue()+ '|' +
standardFields.model_id.getDisplayValue();
}
return '';
},
type: 'getComputerFields'
});
Catalog Client Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
alert('onChangeSerialNumber'+ newValue);
{
var vserial_number = newValue;
alert('onChangeSerialNumber newScript ' + newValue + " = " + vserial_number);
var ga = new GlideAjax('x_g_lme_ham_classi.getComputerFields');
ga.addParam("sysparm_name", "getcmdb_ci_computerFields");
ga.addParam("sysparm_serial_number", vserial_number);
ga.getXMLAnswer(getResponse);
}
}
function getResponse(response) {
var values =response.toString().split('|');
g_form.setValue('manufacturer', values[0]);
g_form.setValue('model', values[1]);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 09:32 AM
Kumar appreciate you helping me. Those two fields are reference fields. I try your suggestion and the results are: the manufacturer is displaying the sysid of the reference fields instead of the value.
Any other suggestions, please. OR let me know what additional information I need to provide you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 09:17 AM
Hi,
Can you click ctrl+shift+i and see what is the error in your console
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 09:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2022 08:51 AM
Update you catalog variable 'manufacturer' to reference type of variable.
Looks like you marked your own answer as correct.
Mark as correct and helpful if it solved your query.
Regards,
Sumanth