Changing how CI is named during asset creation

David Casper
Tera Guru

I'm in the process of manually bringing in existing assets that won't be discovered. I've been researching how to handle the display name as we have not implemented asset tagging yet and our users are used to specific ways to name their assets. 

Currently I'm thinking of inserting the asset name into the asset tag field, but I'm open to any suggestions. 

The main reason for this post is to see how to edit the way the CI is named when an asset is created. I know there is a BR calling the AssetandCI script include. However I'm not 100% where the naming is occurring. I know the asset tag is included in the CI name, but I don't see that in the function. 

As I stated my goal is to change how the CI is named. In my temp workaround situation I'd like to just name it the same as the asset tag, at least during my initial import. However I am aware that with the way it is currently configured when we add real asset tags later it will auto update the CI name to include that tag. 

Thanks in advance!

8 REPLIES 8

Matthew Smith
Kilo Sage

Hi David

The function "createCI" within the AssetandCI script include looks to be what is populating the CI name on Insert. In my New York instance, its line 171 where this is set:

if (ciClass != '') {
			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;

 

- Matt

Thanks for the reply. That's what I was thinking when I posted this. Will have to play around...hate changing OOB code though.

Have you changed the way the asset/ci naming convention works?

Matthew:

Did you play around with this at all? Maybe I'm missing something, but the CI name seems to be

asset.asset_tag + ' - ' + asset.model

In the AssetandCI SI you listed, it shows ci.name = asset.model.name which would just be the model name. There has to be another naming rule that combines the two?

Hi David

Ah, in that case I think yours is being set by the "AssetUtils" Script Include (called by "Calculate display name" Business Rule):

calculateDisplayName : function(asset) {
		var display_name = "";
		if (asset.asset_tag)
			display_name += asset.asset_tag + " - ";
		if (asset.model)
			display_name += asset.model.display_name;
		
		if (asset.display_name == display_name)
			return false;
		
		asset.display_name = display_name.trim();
		return true;
	},

 

- Matt