- 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-05-2018 07:45 AM
Dear Holly,
What is the cmdb table name that we are looking at?
I checked the scripted include(AssetAndCISynchronizer ) and the BR that invokes it from cmdb_ci table. If you look at the condition field, you will see that it wont invoke the BR unless asset value is present. Wondering how this BR is executing if the Asset column is empty on the CI record.
Thanks
Anil
- 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-05-2018 07:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2018 08:00 AM
I would comment that current.update() ( obviously ) but to keep asset_tag field same as serial number on the asset record ( alm_asset) a business rule on that table would do.