- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 10:59 AM
I have been having an issue and I have opened a HI ticket but not getting very much traction.
We have cssm and discovery running. I can recreate my issue fairly easy.
I can see the CI being created, the Model gets created, the Asset gets created and on that asset the CI field(link) gets populated but then the Asset field(link) on the CI does not get populated. Because of that I end up with many asset duplicates because every update to that CI creates a new Asset.
I really think the whole issue is why is the Asset field(link) not updating back onto the CI. ACL? Script? Has anyone else ever had this issue??
Solved! Go to Solution.
- Labels:
-
Enterprise Asset Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2018 07:46 AM
OMG I think I found it. I was searching other posts about "java.sql.BatchUpdateException: Duplicate entry" and read about before scripts that should not contain update(). Well look what I found. This is a before script and when I turned if off, everything worked as designed with the exception of the asset tag did not get populated.
(function executeRule(current, previous /*null when async*/) {
if (current.cost<=2000)
{var str = current.model.manufacturer.name;
var ser = current.serial_number;
var res = str.slice(0, 3);
if (current.model.manufacturer.nil()){
current.asset_tag=ser;
}
else if (current.serial_number.nil()){
current.asset_tag=res;
}
else {
current.asset_tag=res+"-"+ser;
}
current.update();
var ca = new AssetAndCISynchronizer();
ca.syncRecords(current, 'cmdb_ci');
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 12:34 PM
Dear Holly,
When you do a show xml on the CI record do you see that the asset is showing as blank. If yes then it could a BR on the cmdb_ci that is preventing the update of CI record with the Asset reference. As mentioned by rajeev.vunukonda it would become easy to debug if you see the creation of asset manually by following above steps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 02:25 PM
it was truly blank. I did what you suggested and delete the asset and ci and created just the ci. went to create asset and got this error.
java.sql.BatchUpdateException: Duplicate entry '8eafa561db845b40b6337c1ebf961947' for key 'PRIMARY'
is the delete not cleaning things up? What entry is this, how do I debug?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 02:30 PM
perfect. we are on the right track. I would check to see if there is a record already in alm_asset table with sys_id = '8eafa561db845b40b6337c1ebf961947'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 02:44 PM
It does exist on alm_asset but its the one that was just created. So I am thinking it created it, gave an error and then did not update the CI. Does the system put that sys_id somewhere else for the linking?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 03:10 PM
do you know if any customizations were done to the BRs on cmdb_ci ? looks like its trying to create an asset when trying to relate a CI to asset without checking to see if the asset already exists.