Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to determine non-normalized product models

_lcrsrms_
Tera Expert

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:

calculateSoftwareModelDisplayName
calculateModelDisplayName
 
For non-normalized ones it will call this function 
calculateDefaultDisplayName

 

 

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 

calculateDefaultDisplayName according to our needs.

 

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!

0 REPLIES 0