Notifications

418 views

Description

Description


There might be some situations where we need to map the models with while importing the configuration items and/or assets. Many times we may end up having duplicate models or empty values in the models. Or sometimes the models with unknown values.

This KB addressed how to map the models in the best way.

Background


ServiceNow OOB, models are built using the manufacturer, model, and model categories. Using this it uses the OOB script include "MakeAndModelJS" to create the models from the given manufacturer and model if the there is no existing model found with these inputs.

Script Include Name: MakeAndModelJS - /nav_to.do?uri=sys_script_include.do?sys_id=d7c58843ef72010098d5925495c0fb82

Procedure


Within your transform map make use of the below code and pass the proper parameters and it will take care of creating/finding the models and passing to them accordingly. 

- On the transform map click on "Run Scripts" and use the following line of code: 

runIt();

function runIt() {
setMakeAndModel();
}

function setMakeAndModel() {
var mm = MakeAndModelJS.fromNames("VAR_MANFACTURER", "VAR_MODEL_OF_DEVICE", "VAR_MODEL_CATEGORY");
target.model = mm.getModelNameSysID();
target.manufacturer = mm.getManufacturerSysID();
}

/* Replace the variable as below:
VAR_MANFACTURER: Manufacturer name
VAR_MODEL_OF_DEVICE: Device Model
VAR_MODEL_CATEGORY: Model type (like hardware, consumable, application etc etc)
*/

 

Sample Transform Map with this change looks as below:

Applicable Versions


All

Additional Information


Refer  Create a transform map for more information about the transform map "Run Scripts".

Article Information

Last Updated:2019-08-02 20:53:32
Published:2019-07-23
Pasted image.png