- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2019 07:17 AM
Is it possible, perhaps through field map scripts, to update the model & model category reference field during an import to the hardware table?
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2019 07:25 AM
You will have to create two transform maps
1. First map to import hardware models - create models and tied model categories to the model. Make sure to ignore for any invalid model categories. This should be done to import any models that are not in ServieNow.
2. Second map to import assets and tie the first imported model and associated model categories to the asset
In the field mapping you can try below code. you can try this for both model and model categories
var modelname='value from import set';
var model = new GlideRecord('cmdb_hardware_product_model');
model.addQuery('display_name', modelname);
model.query();
if(model.next()){
target.model = model.sys_id.toString();
}
Hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2019 07:25 AM
You will have to create two transform maps
1. First map to import hardware models - create models and tied model categories to the model. Make sure to ignore for any invalid model categories. This should be done to import any models that are not in ServieNow.
2. Second map to import assets and tie the first imported model and associated model categories to the asset
In the field mapping you can try below code. you can try this for both model and model categories
var modelname='value from import set';
var model = new GlideRecord('cmdb_hardware_product_model');
model.addQuery('display_name', modelname);
model.query();
if(model.next()){
target.model = model.sys_id.toString();
}
Hope this helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2020 06:40 AM
Recently I was able to import Models & fields except the Category field through the Excel Import.