How to determine non-normalized product models
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2024 03:56 AM
Hi, Community.
We have a requirement to update model.display names of non-normalized models. I found this Business Rule - Calculate display_name (https://<YOUR INSTANCE>.service-now.com/now/nav/ui/classic/params/target/sys_script.do%3Fsys_id%3Db5...)responsible for updating the model.display name:
function _calculateDisplayName(){
global.ModelUtils.calculateDisplayName(current);
}
_calculateDisplayName();
I checked calculateDisplayName function. For normalized model, it will call these functions to update the model.display name:
ModelUtils.calculateDisplayName = function(model){
var modelClass = model.sys_class_name.toString();
if (modelClass === 'cmdb_software_product_model' && GlidePluginManager.isActive('com.snc.sams')) {
new SAMPSWModelUtil().calculateSoftwareModelDisplayName(model);
} else if (GlidePluginManager.isActive('sn_hamp') && sn_hamp.HAMConstants.MODEL_TYPES.indexOf(modelClass) > -1){
sn_hamp.HAMUtils.calculateModelDisplayName(model);
}
else {
global.ModelUtils.calculateDefaultDisplayName(model);
}
};
I've already updated
ModelUtils.calculateDefaultDisplayName = function(model){
//var values = [model.manufacturer.getDisplayValue(), model.name, model.version, model.edition];
var values = [model.manufacturer.getDisplayValue(), model.name, model.model_number];
model.display_name = ModelUtils.generateDisplayName(values);
};
My next action step is to come up with Fix script to update non-normalized model.display name to "Manufacturer + model.name + model.number", can you assist on how we can extract those records in cmdb_model table?
Thank you in advance!