Changing how CI is named during asset creation

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2020 02:28 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2020 02:53 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2020 12:43 PM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2020 02:20 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2020 01:17 AM
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