How to Display Two Columns in a Reference Field in ServiceNow

With Laurence Tindall



In this article, you will learn how to add two columns in a reference field on a form. This amazing enhancement only takes a few minutes to implement, and provides a ton of value for anyone using the system. By having two columns displayed on a reference field, you're able to enter additional values to narrow down your search when trying to select a record in a reference field.


For example, say you are logging an incident on behalf of a user and there are several users with the same name within your organization. By enabling an additional column, such as email address, you'd then be able to see their email address when selecting their name. This feature is especially useful when you're referencing a table that uses a non-unique display value and you'd like your users to easily identify the correct record they're looking for.


Adding an Additional Column to a Parent Field


Now that we've talked about the benefits of this enhancement, let's head over to the hardware assets form where we'll add an additional column to the parent field. In the parent field when we enter Dell, only the assets’ display name is displayed. As an asset manager, this list is not currently useful to me because I can't identify which asset I actually want to select. In order to add some uniqueness to these values, we are going to add the serial number column as our second column to this reference field. To do this, right-click on the parent field and click on configure dictionary; you'll now be taken to the dictionary entry record for the parent field on the asset form.


The field we'll be working with today to add this additional column, is the attributes field. If you can't see this field on the form, click on that advanced view UI action, which will be displayed underneath the related links section of this form. To add the additional column to this field, we'll want to start entering our attributes. The first one we want to add is ref_auto_completer= AJAXTableCompleter. This attribute enables you to display the value column of the reference table being referenced and any additional columns listed.


Next, we're going to add ref_ac_columns=serial_number. This attribute is adding the second column to the reference field; which in this instance is the serial number. The final attribute we're going to add is ref_ac_columns_search=true. This search attribute basically enables autocomplete to work with all fields being displayed in the reference field.


The attribute section should read: ref_auto_completer=AJAXTableCompleter,ref_ac_columns=serial_number,ref_ac_columns_search=true.


Now that we've completed adding these attributes, click on the update button. You'll now be taken back to the hardware asset form. You'll now notice if we enter Dell in the parent field, the serial number column is available and we can search against these values.



Did you find this How to Display Two Columns in a Reference Field in ServiceNow article helpful? Are you ready to start your journey with ServiceNow? If you want to find out more information about GlideFast Consulting and our ServiceNow implementation services, you can reach out to us here.

 

About GlideFast Consulting

GlideFast is a ServiceNow Elite Partner and professional services firm that provides tailored solutions and professional services for ServiceNow implementations, integrations, managed support services, application development, and training. Reach out to our team here.


61 views0 comments