How are Product Models created on import?

peterraeves
Mega Guru

We had our CMDB in an SQL DB and wanted to import it in SN. In the "Model Categories" table, we set "Enforced Verification" to true for all classes that we will be importing, so no assets are created. We want to do this manually. Seeing we don't have "Product Models" yet, when we import CIs, the product model is automatically created, which is great. The problem is that, for Monitors for example, all Product Models seem to add both "Bundle" as category, as well as "Monitor", but we obviously only want the model category to be "Monitor". Also, I noticed that the product model's class is the generic one and not any specific. We obviously want to have "Hardware Models" in this case.

So what I'm trying to understand is the process from when the model id (eg: "HP LA2306" of a "Computer Display Monitor") enters the system, how it is transformed into an actual "Product Model" and how this can be configured, to create an Hardware Model, with "Monitor" as Model Category.

FYI: We removed the Monitor Model Category and re-added it, linked to the cmdb_ci_display_monitor class. OOTB, there was no class filled in, in the Monitor Model Category, which was very strange.

1 ACCEPTED SOLUTION

Not really . I was talking about the creation of product models, not assets.



One of ServiceNow's engineers just called me directly and he explained what was happening. It looks like Product Models are not created as expected, because there just isn't enough to go on, as the only thing we have is the Model's name. Therefore, they suggested to either manually create the models, before importing, or to create a separate Transform Map, to run before the other one, which will first set all Product Models. That way, we can specify how they should be set and how the fields should be filled in. The newly created Model in the first TM, could then be referenced in the second.


View solution in original post

8 REPLIES 8

Deepa Srivastav
Kilo Sage

Hi Peter,



Below blog series and link might be helpful to you.



Models vs. Model Categories: Model Management, Part 2


Creating New Models - ServiceNow Wiki



Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.



Thanks,
Deepa


annmoleapen
Giga Contributor

Hi Peter



Did they explain to you what Business rule is running behind this? I need to get these product models created from import to be created in Hardware Models... Please help if you know where to change this?



Thanks


Ann


We scripted it ourselves. We created a function that returns the sys id of the (new) model we want to reference.



getModelID: function(source) {


  var value = source.u_model;


  var gr = new GlideRecord('cmdb_hardware_product_model');


  if (!gr.get('name', value)) {


            var manufacturer = new GlideRecord('core_company');


            manufacturer.get('name', source.u_manufacturer);




            gr.initialize();


            gr.setValue('name', value);


            gr.setValue('manufacturer', manufacturer.getValue('sys_id'));


            return gr.insert();


  }




  return gr.getValue('sys_id');


},


Then we put the script in the Model ID field map, which uses 'sys_id' as referenced value field name


Thanks Peter...