Restrict Asset Creation from CI based on Serial Number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2024 10:40 PM
Hi All,
In our CMDB Hardware table we have Ci Identifiers as Name+Serial Number for identifying a CI. Due to that Discovery/3rd part Integration is creating CI's with the same Serial Number but different Names which is an expected behaviour. But in AMDB, Serial Number is considered as Unique Identifier and whenever the combination of New name+same serial number is getting created in CMDB, it creates Duplicate records in Asset table. What is the best practice to prevent duplicate being created in Asset table based on Serial Number alone? Please share your inputs if anyone have worked on similar requirement before. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2024 11:04 PM
Hi @Suvetha S
when a new CI is being inserted or updated with a particular Serial Number, first search the AMDB for an existing asset with the same Serial Number.
Manually check for the serial numbers you want to load on your alm_hardware table. and also check for the configuration item on cmdb_ci_computer table, also consider model in it.
If an asset with the same Serial Number exists, prevent the creation of a new asset, and consider linking the existing asset to the new or updated CI, or log this for manual review.
- If no existing asset is found, proceed with the asset creation.
This practice we always follow in daily use while load data into our CMDB or AMDB.
Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards
Deepak Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2024 11:41 PM
Hi @Deepak Shaerma ,
Thanks for the response. the duplicate asset records are being created by Crowdstrike. is there a way to restrict it by script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2024 01:36 AM
Hi @Suvetha S
yes its possible to check the uniqueness. best way is to write a business rule
When : Before - Insert and Update Both------> to check the uniqueness on form
var assetGr = new GlideRecord('alm_asset');
assetGr.addQuery('serial_number', current.serial_number);
assetGr.query();
if (assetGr.next()) {
// If asset with same serial number, and it’s not the current record being updated
if (assetGr.sys_id != current.sys_id) {
// Prevent the record from being saved and show error message
current.setAbortAction(true);
gs.addErrorMessage('An asset with this serial number already exists.');
}
}
Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards
Deepak Sharma