Controlling Reference Variable Display

Casey Verhagen
Giga Guru

We have a reference variable in which users can select the asset tag for a device that they are submitting the request on. The field references a custom table that extends our CMDB.

 

Originally, we were utilizing the asset tag field in the CMDB import to populate the both the Name and Asset tag fields in the custom table. With a new naming convention coming soon for these devices, we have modified the way the device import works and so we will be getting the actual name and the asset tag individually.

 

This brings me to the issue we are experiencing. Because the "Name" field is the default display field, when the user selects the correct asset tag from the reference field, the reference field is actually populated with the name instead of the asset tag. I know that you can change the "display" field on the table, but then this has the unintended consequence of changing the behavior for all CMDB references in the instance which we don't want. This is because when you go to the table and try to update "Display" to True, you see the following message on the record "This cloned descendant element is read-only,  Click Here to open editable first element (cmdb.asset) in a new window." So the only way to do this (that I'm aware of) is to set it for all CMDB items.

 

Does anyone know how I can continue to show the "Asset tag" field in the reference variable for this one catalog item so that other areas of the system aren't impacted?

 

TIA

1 ACCEPTED SOLUTION

Casey Verhagen
Giga Guru

In case anyone else is running into something similar, I wanted to add my additional thoughts, findings and the solution we are going with in hopes that maybe it will save others from wasting as much time as I did on this. 😂

 

Solution:

The TLDR version is that we are going to create a new field in the table for asset tags, so that we don't have to rely on the asset_tag field that's inherited from the parent CMDB table (which gives us the error I mentioned in the original post). When the import runs, it will populate the asset_tag field as well as our new u_asset_tag field. Doing this allows us to set the u_asset_tag display attribute to true without impacting other reference fields that point to a CMDB table.

 

Additional thoughts and findings:

A lookup select box "COULD" have been a resolution to this because the lookup select allows you to choose the field that you want to search. I really wish reference fields had this option too. Anyway, the reason this won't work for our need is because the lookup selects are limited to 10,000 records. It is also much slower to load since it's trying to pull in all 10,000 records at the same time. So for smaller tables, this is a good option, but with 30,000+ records in our table, this wouldn't work for us, even with filters in place.

 

Also, I found that the variable attribute that Steven provided was actually working, sort of. When you start typing an asset tag in the reference field, it doesn't actually work as the user needs to search the name. In our case, some of the device names also matched the asset tag, so in that case it appeared to be working successfully even though it truly wasn't. Then for devices that didn't have a name and only had an asset tag, you couldn't do a search. This is how I discovered that you couldn't actually search by the asset tag. 

 

Before coming up with the solution above, we were ready to settle on two other possible options. We were either going to make the field a text field, and expect that users will enter the correct asset tag (we already have a text field in the event that a user doesn't find the asset tag in the system), or we were going to create a new table that doesn't extend the CMDB and import the same data into that table which would then allow us to set to the display value to true on the asset tag field without impacting the CMDB. Thankfully the solution above prevents us from more or less duplicating another table, and instead we are able to accomplish the goal by only duplicating a single field.

 

The last item in all of this, is if you are allowing someone to select a CI (in an incident for example), you will be able to select these devices by searching for the asset tag when you click on the magnifying glass in a reference field. However, the solution we are going with will still show the name field as blank. This is something we have decided to live with as the naming convention for these devices is yet to be determined and will likely only impact new devices going forward. It will still however allow us to track incidents against the CIs which is necessary in our, and probably most, users' organizations.

 

Hope you find this information useful!

View solution in original post

6 REPLIES 6

Steven Parker
Giga Sage

In the variable attribute of your reference field, enter this:

 

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=asset_tag,ref_ac_columns_search=true

 

This will add the Asset Tag column to the reference field, along with the name, and allow it to be searchable.

 

Here is an example against the computer table:

StevenParker_0-1683665884816.png

 


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Hmmm.... That didn't seem to work. That method would also present another issue though. This is actually a record producer, not a catalog item as I indicated earlier. We take asset tag from that field and create a work order in a separate system.  So if that reference had the name and the asset tag together, that would throw off the other system. 

Well it just displays additional information so that picking the correct record is easier.  The reference field would have just 1 sys_id in it and it would be the Name of the record.  Whether they are selecting the Name of a record or the Asset Tag of a record...both are going to end up with the same results and that's 1 sys_id from the Reference Field (unless you are passing the displayValue to your work order system).

 

Since Asset Tag is a string field...couldn't you just create another field on the record producer and auto populate it for the user when they select the Name in the reference field?  Then you would just need to create a work order from that new field instead of the reference field.

 

Without making the "Asset Tag" display value to true, it's not going to show up in the reference field by default.


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

I get what you're saying regarding the sys_id and could make that work. However, the other parts not so much.

 

The issue here is that end users don't know the name of these devices which is why we are only trying to show the asset tag. Adding a second field to populate the data would end up looking clunky on the form, especially in the case of older devices where the name field is empty.

 

Making the asset tag field the display value would be great, but I don't know how to do that without impacting the rest of the CMDB tables given the informational message that I mentioned in the original post.