Cleanup display_name in cmdb_hardware_product_model (No HAMP)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi,
i work on this problem for a couple of hours already but i still can not figure out a solid approach.
In cmdb_hardware_product_model we have Notebooks with Manufactuer HP and Name "HP Elite x360 830 13 inch G11 2-in-1 Notebook PC" this Creates a display_name "HP HP Elite x360 830 13 inch G11 2-in-1 Notebook PC". Our Procurement Guys dont want that HP HP. This Displayname gets created via OOTB BR "calculate display_name" on cmdb_model.
function _calculateDisplayName(){ global.ModelUtils.calculateDisplayName(current); } _calculateDisplayName();
So i thought i'm super smart and do something like this:
function _calculateDisplayName() { var mfg = current.manufacturer.name + ""; var modelName = current.name + ""; if (mfg === "HP" && modelName.startsWith("HP ")) { var newName = modelName.substring(3).trim(); if (newName !== modelName) { current.setValue('name', newName); } } global.ModelUtils.calculateDisplayName(current); } _calculateDisplayName();
What now happens, i get a stripped display name only with one "HP" as expected, but every Endpoint discovered gets its own hardware model, so suddenly i have a ton of duplicate HW Models each with one single asset/ci linked.
What is going on here? Did i miss some crucial step in the Asset/Ci creation?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
The display name is a concatenation of name and manufacturer. Remove the HP from the name and you won't get double HP in the display name.