Asset tag and configuration item should be same

Aakash Shah4
Tera Guru

Hello Experts,

When i am trying to create a new asset by going to Asset -> All assets -> New -> Hardware

I fill all the mandatory fields along with the field Asset tag.

After submitting the form the Configuration Item is filled with the same name as the Asset tag.

This is happening with the Fuji Release but not in the Istanbul release.

In Fuji :

find_real_file.png

In Istanbul

find_real_file.png

Any suggestions on this ?

1 ACCEPTED SOLUTION

At least with Helsinki, the logic is to create a new CI if one does not exist for the asset, which can lead to duplicate CIs.



This is the createCI function in the AssetandCI Script Include:


var ci = new GlideRecord(ciClass);


ci.initialize();


ci.asset = asset.sys_id;


// in the absence of a calculated name for CIs, set


// something so links don't appear blank


ci.name = asset.model.name;


// Populate manufacturer


ci.manufacturer = asset.model.manufacturer;



// inherit values from asset for shared fields


var sync = new AssetAndCISynchronizer();


sync.syncRecordsWithoutUpdate(asset, ci, 'cmdb_ci', false);



// insert CI record and stick its reference in the asset


asset.ci = ci.insert();



When it creates the CI, the display name will be the asset model name.   You can either change this script to set the CI name to asset.asset_tag or set the display field for CI to asset_tag which will apply to every form.


View solution in original post

8 REPLIES 8

Hello Andrew,



Thanks for the help. Could you please let me know what if some one updates the asset tag.


In this case the CI should also be updated accordingly but this is not working.



I tried creating a BR on asset table but the value is not getting updated.


Could you please help


The Asset CI Mapping table and Script Include AssetAndCISynchronizer does the magic behind the scenes.   Unfortunately, you cannot add a field twice to the mapping table.




What should happen if someone updates the name field on the CI record?   How did you construct your BR?



If you create the CI first, the asset is named "asset tag - model id", and when you update the asset tag on the CI record, the asset name is updated too.



Are you populating CIs through a discovery tool integration?


Aakash Shah4
Tera Guru

Hello Guys,



Thanks for your response i found the solution.


There is script Include AssetandCI



there i added the code in the function createCI




if(!asset.asset_tag.nil()){


  ci.name = asset.asset_tag;


  } else{


  ci.name = asset.model.name;


  }


Thank you so much for this! I've been trying to find out where this script was and couldn't find it for a long time. Thank you again...very helpful!