- 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 11:21 AM
Hi Holly
Is there an entry created for CI class to asset class mapping in table "cmdb_model_category"?
If yes, Please check below business rules on cmdb_ci table:
1. Create Asset on insert
2. Create asset on model change
3. Update Asset fields on change
Also check the script includes: "AssetandCI" and "AssetAndCISynchronizer".
Regards
Himanshu Verma
+91 9717862054
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 11:48 AM
Yes there is an entry in model category. I don't think it would have created the asset without that.
Checked all of those. All are model and active. The only difference I saw was line 169 in AssetandCI to add serial number "ci.name = asset.model.name + ' - ' + asset.serial_number;" Pretty sure that is not the issue.
We also have the honor of being an express converted to enterprise. No to say that's the issue, but you never know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 12:25 PM
Hello holly,
1- Check the model category if it has a CI class and Asset class associated to it
2- Try using the Enforce CI verification field on the model category.
3- If you are not able to figure out the Duplicate Assets issue, first turn ON the Enforce CI verification to TRUE so that CI's don't create Assets on itself unless you click on the field 'create assets' on each model category
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 12:34 PM
I guess I am not being clear. The CI is not getting the asset field(link) populated. That seems to be the stem of the issue. Its not every time, so the ones that work show everything is set up correctly but the ones that don't.... really don't.
I can delete the asset record, the ci record and run a discovery to let it populate fresh and again the CI is created, the asset it created with the CI field(link) populated and then the asset field on ci (link) is blank and not updated.