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 06:52 AM
Hi! I'm not sure if that works because the "virtual" column is not stored in the cmdb_ci table where the business rule is running from. But I'll give it a go and let you know what happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2018 07:13 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.