The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Hardware table as reference field in catalog

EktaK
Tera Contributor

Hello All,

 

I have created a reference variable Serial Number which is referenced to Hardware table(cmdb_ci_hardware)

Once I open variable in catalog form, I am not able to see Serial Number, instead i can see(name, Model ID, manufacture...) in reference Column.

 

Even if I select any value, It will give hardware name... Instead i want to print Serial Number of hardware.

 

Thank you in advance.

7 REPLIES 7

AkashK823386499
Tera Contributor

This is a common scenario in ServiceNow catalog items when using reference variables.
By default, a reference field displays the Display Value of the target table (for cmdb_ci_hardware, the default display field is name). That’s why you see name instead of serial_number

Use a Lookup Select Box (Alternative)

Instead of a reference field, you can use Type = Lookup Select Box.

  • Table: cmdb_ci_hardware

  • Value field: sys_id

  • Label field: serial_number

This way, users see serial numbers in the dropdown.

Hello @AkashK823386499 

Thank you.

I have tried by changing it as lookup, it is coming fine.
but issue is, it contains lot of data and not able to search here.

Also there is one more variable "model id", that is also a reference field and fetching the value based on Serial Number. Now this is also not working as i change the type of variable.

RaghavSh
Kilo Patron

1. Reference field can only show the display value of table which is name, its not recommended to change it.

2. To show serial number in list view , you need to update the syspop_up view of hardware table.

 

refer: https://www.servicenow.com/community/developer-forum/how-do-i-configure-a-pop-up-view-on-a-reference... 


Raghav
MVP 2023
LinkedIn

@EktaK Changing display value of table is not recommended as it is instance wide change and will have an impact on entire instance. so try the solution above and add below:

 

1. Add attributes to your reference qualifier

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=serial_number;model_id,ref_ac_columns_search=true

you can define any number of columns to search.

 

2. If you specifically want to show the serial number, create one more string variable below the reference variable and populate the serial number on change of hardware using on change client script and script include(glide ajax). There are multiple examples of such code on community 


Raghav
MVP 2023
LinkedIn