"Display name" of Product Models [cmdb_model] table starts with " "(blank space), how to remove it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2022 01:38 AM
Since "Display name" of Product Models [cmdb_model] table is the concatenation of "Manufacturer" and "Name" fields, when the "Manufacturer" field is blank, "Display name" starts with blank space as below...
We would not like to populate "Manufacturer" field, so could someone please let me know how to remove the space?
*I understand the OOTB "ModelUtils" Script Include populate the concatenated value into the "Display name" field, but would not like to customize it..
Best Regards,
Aki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2022 01:43 AM
Hi,
As per OOB behavior Display name is combination of Manufacturer and Name. I would recommend dont touch the code to change the behavior. If you change it will affect existing product models.
The best practice is manufacturer also derives model display name.
Regards,
Suresh.
Suresh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2022 10:01 PM
The issue I'm finding is that SN refuses to write the manufacturer for some reason. No indication why this is, it's just always blank. You also can't directly write the display_name apparently as that's ignored and it uses the concatenation, which means the display name is the model name because you can't write the manufacturer. On top of all this, it constantly creates duplicates instead of refusing to make another model that is identical to one that exists. That's a fundamental failure honestly. Seems like the whole thing just isn't functional.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2022 01:56 AM
You can try trim() function to remove spaces.
On BR, you can write a condition
if manufacturer is empty,
current.display_name = current.display_name.trim() ;
But since its read only , i dont think it will work
But wait a second, i don't find any empty space if manufacturer is empty in my PDI.
I think space is on your product model name. "microsoft visual....."
If its helpful, please mark answer as correct
Anshu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2022 02:05 AM
Hi,
You can try the below changes for this -
- Go the OOB script and do the required changes on it and then Insert & Stay. By doing this you are creating a new script with the modification of your changes.
- Now disable (active as false) the existing OOB script, so that your newly created script will be executed for now.
Things to Remember (before modification)
- Service Now not recommend changing any OOB script (that's why create new script and inactive the OOB one in needed).
- If you are changing any OOB script then Service Now will not update that script while doing upgrade activity.
Modification on existing one
var displayName = '';
if(manufacturer == '' && name != '') {
displayName = name; //If 'Manufacturer' is empty
} else if (name == '' && manufacturer != ''){
displayName = manufacturer; //If 'Name' is empty
}else {
displayName = manufacturer +' '+name;
}
Mark this as Helpful/Correct, if Applicable.
Regards,
Sourabh