- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2025 01:55 AM
Hello Team,
I have a requirement in service catalog, The CI name and serial number of same CI should be visible in CI field.
Example: CI - Serial number (abc1234 - 009988776).
Is it possible? I have written script include client callable over reference field type but its not working,getting serial number in log but its not setting up over CI Name field, is there anyways?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2025 10:17 AM
Hi @Avinash_M
Yes, that is expected. In a variable, only one value will display, and that’s based on the display value. You can search using two values, but the display will always be based on one value.”
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2025 05:16 PM - edited 08-24-2025 05:16 PM
Try below it should work, Solution : Script Include + Client Script
Script Include (Name: GetCIDisplay, Client callable: true):
var GetCIDisplay = Class.create();
GetCIDisplay.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getCIDisplay: function() {
var ciSysId = this.getParameter('ci_sys_id');
var ci = new GlideRecord('cmdb_ci');
if (ci.get(ciSysId)) {
var displayValue = ci.name.toString();
if (ci.serial_number && ci.serial_number != '') {
displayValue += ' - ' + ci.serial_number.toString();
}
return displayValue;
}
return '';
},
type: 'GetCIDisplay'
});
Client Script (Type: onChange, Variable: your CI field):
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue) return;
var ga = new GlideAjax('GetCIDisplay');
ga.addParam('sysparm_name', 'getCIDisplay');
ga.addParam('ci_sys_id', newValue);
ga.getXMLAnswer(function(answer) {
if (answer) {
g_form.setValue('your_ci_field_name', newValue, answer);
}
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2025 05:29 PM
Can you share your script to see why it is not working ?
You can glide record on cmdb_ci table using CI sys_id and get the details of Serial number [if field value is not null] and CI name and concatenate it and set the value in the variable.
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan