sync all the fields of asset when update on cmdb

Aishwarya20
Tera Contributor

Hi,

I want to sync all the fields same as cmdb, there is mismatch between cmdb and asset and cmdb data are correct.

I want to update all the fields on asset level, when one single field on cmdb is updated(for ex comments) then all asset field can be updated automatically

i written this script to update but this is not updating all fields on asset level

var currentCI = new GlideRecord('cmdb_ci');
currentCI.addEncodedQuery('name=abc');
currentCI.query();

while(currentCI.next())
{
   currentCI.comments = "test";
	
   var ca = new AssetAndCISynchronizer();
   ca.syncRecords(currentCI, 'alm_asset',false);
   currentCI.update();
}

Please help me on this

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

this happens OOB

Asset and CI management

As per docs

When an asset has a corresponding configuration item, the asset record and the configuration item record are kept synchronized with two business rules.

  • Update CI fields on change (on the Asset [alm_asset] table)
  • Update Asset fields on change (on the Configuration Item [cmdb_ci] table)
Note: Assets and CIs can be synchronized only if they are logically mapped.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes I know these business rules, but i want to map mismatched data... how can i do it?