Fix script for Product model re-formatting to comply to the normalized model in Content library

KirilD
Tera Contributor

Hello,

I have some issue with importing assets via Import set. Usually we import some assets from old systems, where the model is 99% not compliant with the models in the content library. Also during the import, I noticed the product model is created directly in [cmdb_model] (Product model) table. But I actually need this to be in the [cmdb_hardware_product_model], where the normalization could happen. I'm wondering if someone is aware of a fix script, which can run against the imported (along with the assets) not-normalized product models and fix it, based on a lookup in content library ( [sn_hamp_hw_product_model] table) ?

2 REPLIES 2

Mark Manders
Mega Patron

That means that het assetrecord is referencing the cmdb_model table and not the cmdb_hardware_product_model table. And since your transform map is set to 'create' if the model doesn't exist, you need to change the reference on the asset table, or this will keep happening. 

And I would just check on any cmdb_model record that is related to hardware and if not yet exist in cmdb_hardware_product_model, create it their (or change the class through script). But start with preventing the import from creating those models, or you will keep on correcting data.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

hi, the target import table is [alm_hardware], and one row of asset to be imported, contains columns, mapped to [model_category]-(reference field) and [model]-(reference field). So it is by default, the [model] attribute in the asset table points to [cmdb_model] (Product model) table. The problem with preparing the proper product model before the import is that they are hundreds, so I was wondering if I can import the assets first and then fix the models with a script. That's my question here