CI is creating an Asset with the link but the asset link is not populating on the CI.

holly-t
Tera Guru

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??

1 ACCEPTED SOLUTION

holly-t
Tera Guru

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);


View solution in original post

18 REPLIES 18

I had checked the 3 business rules listed above and the 3 script includes and they are model, as I compared to my person instance. The one customization was listed above on CI.name, but that's all I see.



the asset did not exist then I pressed create asset on the CI and then the asset was created and then I got the error message before the CI was updated.


So I went down the path of debugging BR with details and in the middle of the list I saw this.



06:47:31 AM.549: : Aborting Asset to CI sync due to pointer mismatch



Hi Holly



It seems, above error is being received only because asset field is not populated on CI record. It comes from script include "AssetAndCISynchronizer" from the function "syncRecordsWithoutUpdate".



I think for all the CIs where asset is not being mapped correctly, Please check for the "Model ID" field. if it appears as "UNKNOWN" or blank, try mapping correct "Model ID" and run the asset creation process from Model Categories.



Regards


Himanshu Verma


unfortunately the model id is not the issue. They do not have unknown or blank, they have valid model id, and manufactures. All of the fields show on that asset and the only thing that is missing is the asset field   on the CI.


Looking at the debug BR is see 3 displays that are correct and it seems it has the data but then after model BR then it shows the error.



08:11:51 AM.412: Global                                 ci:   => f44c43d2dbc8d344cae5fcefbf961944


08:11:51 AM.413: Global                                 source_id:   => 9b1e4712dbc8d344cae5fcefbf9619f8


08:11:51 AM.413: Global                                 source_table:   => u_printer


08:11:51 AM.413: Global             <== 'Set source allocation fields' on fm_expense_line:EXP0026523


08:11:51 AM.413: Global             === Skipping 'Source ID check' on fm_expense_line:EXP0026523; condition not satisfied: Condition: current.source_id.nil()


08:11:51 AM.413: Global             === Skipping 'Move asset expense to configuration item' on fm_expense_line:EXP0026523; condition not satisfied: Condition: current.source_table == "alm_hardware" && !current.ci.nil()


08:11:51 AM.413: Finished executing before insert business rules on fm_expense_line:EXP0026523 before engines (order <1000)


08:11:51 AM.424: Execute after insert business rules on fm_expense_line:EXP0026523 before engines (order <1000)


08:11:51 AM.424: Global             ==> 'Process CI Relationships' on fm_expense_line:EXP0026523


08:11:51 AM.425: Global             <== 'Process CI Relationships' on fm_expense_line:EXP0026523


08:11:51 AM.425: Global             ==> 'Update actuals for task' on fm_expense_line:EXP0026523


08:11:51 AM.425: Global             <== 'Update actuals for task' on fm_expense_line:EXP0026523


08:11:51 AM.426: Global             ==> 'Update Planned Task Actual Cost' on fm_expense_line:EXP0026523


08:11:51 AM.426: Global             <== 'Update Planned Task Actual Cost' on fm_expense_line:EXP0026523


08:11:51 AM.426: Global             ==> 'Process Top Task Parent' on fm_expense_line:EXP0026523


08:11:51 AM.426: Global             <== 'Process Top Task Parent' on fm_expense_line:EXP0026523


08:11:51 AM.426: Finished executing after insert business rules on fm_expense_line:EXP0026523 before engines (order <1000)


08:11:51 AM.429: Global       <== 'Create Expense Line' on u_printer:kmbt7f7569


08:11:51 AM.429: Finished executing after insert business rules on u_printer:kmbt7f7569 before engines (order <1000)


08:11:51 AM.434: : Aborting Asset to CI sync due to pointer mismatch