Mapping CI Operational status choices to the Asset state choices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2021 01:03 PM
Hello,
I hope someone can help me figure this one out. I am trying to sync the CI Operational status field to the Asset state field. Example, if Asset state is 'In stock' and substate 'Pending repair' the Operational status should be 'Non-operational'. How can I accomplish that? This shoiuld be OOB already, but I've added 2 more choices to the Operational status and need to adjust the mapping to direct to the 2 new choices. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2021 01:59 PM
Hi, this is controlled in the OOB 'Update Asset fields on change' Business Rule. This BR calls the Script Include 'AssetAndCISynchronizer'. There are a couple of tables defined, that hold the fields mapping between CI and Asset, like this:
ASSET_CI_FIELD_MAPPING_TABLE : 'alm_asset_ci_field_mapping',
ASSET_BASE_CI_STATE_MAPPING_TABLE : 'alm_asset_ci_state_mapping',
ASSET_HARDWARE_CI_STATE_MAPPING_TABLE : 'alm_hardware_state_mapping',
So it must be pretty straightforward to update these tables with your new values.
** please mark my answer as helpful and correct if it fits your need
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2021 02:17 PM
Thank you on your reply. This option above updates the Status - 'install status' on the cmdb_ci table. That is already in place. I need the Operational status to update when the Asset status is changed. An example would be:
If Asset state substate map to operational status field choice(cmdb_ci)
I am thinking of creating a Business Rule but I am not really sure how the code needs to look like. I've tried using the filter conditions and that did not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2021 12:58 AM
You may create 'Before' (insert/update) business rule on 'alm_asset' table (condition: {State changes}). Then use the script like this:
(function executeRule(current, previous /*null when async*/) {
var grCi = new GlideRecord('cmdb_ci');
if (current.getValue('install_status') == 'In Transit') grCI.setValue('install_status','Pre-Allocation');
if (current.getValue('install_status') == 'Retired') grCi.setValue('install_status','Disposed');
//and so on
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2021 07:50 AM