- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 08:02 AM
I have several physical server assets (eg. Windows Servers)... where we have re-allocated them as Linux Servers. I can change the class on the CI... but the model category on the corresponding asset is still 'Windows Server'.
This doesn't appear to be enabled, even for adminstrators, 'out of the box'. I assume it's because the complexity and rules & processing around asset/ci creation.
How can I update the Asset record with the correct model category?
Solved! Go to Solution.
- Labels:
-
Enterprise Asset Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 08:10 AM
You are correct that there is nothing there and makes sense that the function or type of sever is not defined or changes during the lifecycle. In the past I have added a business rule on the cmdb_ci table to look for changes in class and has an asset record to do something like this below:
updateAssetMC();
function updateAssetMC(){
var asset = current.asset;
var newClass = getModelCat(current.sys_class_name);
var gr = new GlideRecord('alm_asset');
gr.addQuery('sys_id',asset);
gr.query();
if(gr.next()){
if(newClass){
gr.model_category = newClass;
gr.update();
}
}
}
function getModelCat(c){
var gr = new GlideRecord('cmdb_model_category');
gr.addQuery('cmdb_ci_class',c);
gr.query();
if(gr.next()){
return gr.sys_id;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2017 08:31 AM
Depending on when you need to do this.
1) You can create a background script or transform map to update the old records that didn't get changed.
2) For something new and on-going - you will probably need to write a business rule to update the asset model category
This is just a quick/dirty script I did in one of my environments to see the change happen:
var hRec = new GlideRecord('alm_asset');
hRec.addQuery('asset_tag','LNXORA100');
hRec.query();
hRec.next();
hRec.setDisplayValue('model_category','Windows Server');
hRec.update();
Your business rule should probably query the Model Category table to find the ci class that the ci has changed to and use that model category to update the asset. Also, you probably want a condition where asset is not null.
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2017 10:22 AM
Timt,
We are glad you were able to take advantage of the ServiceNow Community to learn more and to get your questions answered. The Customer Experience Team is working hard to ensure that the Community experience is most optimal for our customers.
If you feel that your question was answered, we would greatly appreciate if you could mark the appropriate thread as "Correct Answer". This allows other customers to learn from your thread and improves the ServiceNow Community experience.
If you are viewing this from the Community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2017 04:45 AM
You can usually update the associated CI.
When viewing the associated CI, the "MODEL ID" field may not be on the form view, so add it.
Update it there, there are no ACLs and it will synchronize across to the ASSET.
(I cant determine why they don't allow an edit to the asset, but do to the CI, but I've yet to dig into it that much).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2019 03:32 AM
changing the CI does not change the model category.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 02:16 AM
A solution can also be that all your server hardware are initially categoriesed in the "Server Hardware" category. Then the asset will always have a "server Hardware" class and the CI will show the current installed class.