Don't create asset on virtual server CI

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 03:29 AM
I've seen some threads about this question but nothing that seems up to date.
When we are creating a CI in cmdb_ci_server table an asset is also created. That is OK as long as it's not a virtual server.
How can we handle this? If the is_virtual checkbox is checked, that no Asset will be created?
Here is what I do:
- Go to Windows Server CI. Create New. Fill out forms and mark Is virtual checkbox.
- Save the form
- I see that there is an Asset created and linked to the CI
I know there is a Business Rule called "Create Asset on insert" and here is the input in the advanced tab for the BR.
var ca = new AssetandCI();
ca.createAsset(current);
This BR runs on cmdb_ci table where the virtual is not represented. But this BR runs a script include called AssetandCI. I guess the edit should be done there but where in the file and what? Virtual flag is stored in cmdb_ci_computer table.
virtual != true
What to do? I don't what an Asset created if the "Is virtual" checkbox is checked. (Running Jakarta)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 03:34 AM
Hi Henrik,
you should manage the CMDB vs Asset through the model record.
on the model record you have a category and the category is defining the relation to alm_ and cmdb_ tables.
So we all Virtual servers( virtual=true) are added to a model that have model category = virtual server

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 04:12 AM
Hi Daniel,
I'm not sure that I follow you.. If I create a Windows Server CI like the screenshot above and check the Is Virtual checkbox I don't want to create an Asset.
Should this be specified according to you in: Product Catalog -> Product Models -> Model Categories
I have a Windows Server category there, but that one creates Assets. I assume this should be done in some code to handle my exceptions from creating Assets.
As you see in screen dump we haven't created a model for the CI but isn't it rather strange that ServiceNow creates an Asset then without knowing model Id?
Have you had a similar issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 04:57 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 07:17 AM
Ok. So I've tested it now and no asset is created as long as model id is blank. But as I just wrote it does not relate to the conditions above (highlighted in yellow on your screen shot) since "virtual" is stored in cmdb_ci_computer.
This is good and useful, but I'd really like to trigger on the virtual checkbox...
I can duplicate the code in the business rule and create one for cmdb_ci_server but I'm not that thrilled over that since it would create duplicate code.
But thank you so far.