Multiple Reference Display Values Per Table

//Multiple Reference Display Values Per Table

Multiple Reference Display Values Per Table

When working with reference fields, it is really important to understand how the display value for the reference field works.  The display value for a reference field is what the end user actually sees when they search in a reference field to produce an autocomplete drop down and what they can see when a reference field gets populated.  Information about reference fields and reference field display values can be found here.

Some questions about display values that I hear very often are “How do I show information from more than one field for the display value?” or “Can I have different display values on 2 reference fields that reference the same table?”.  The limiting factor when answering these questions is that you’re limited to a single searchable display value per referenced table. What this means is that EVERY reference field that references a particular table needs to use that table’s display value so you cannot mix and match between reference fields.  There are a couple of options that can be used to provide a bit more information to the user in these scenarios however.

The way I typically approach this type of requirement is to create a new calculated field that is a composite of the fields that I want to search on. Then I make that field my display value for that table. A good example of this is the ‘Name’ field on the user table. What you see is the full name of a user. If you look at the dictionary entry for that field however, you’ll see that it is actually a calculated field that pulls together the values from the First name, Last Name, and Middle Name fields.
Once this is done (and I’ve updated all of the records in the table so that my calculation gets stored on each record) I can make this field my display field for the table and change how searches are performed on references to that table. By using a ‘Contains’ type of search instead of the default ‘Starts with’ type of search against the display value for a table I can effectively search on multiple terms in the same field since I’ve included them in the same display value string. This article explains how to set up a ‘Contains’ autocomplete search for a particular table.

Customizing Autocomplete Search Behavior

Another useful option for reference fields is to display additional attributes in the autocomplete drop-down. These attributes aren’t searchable and they won’t show up as the display value when the field gets populated, but they do make it very simple to display more than just the display value in an autocomplete.

Display Additional Reference Field Attributes

By | 2018-07-09T15:00:11+00:00 April 6th, 2010|Categories: System Definition|Tags: , , |8 Comments

About the Author:

Mark has worked in the IT industry since 2002 and with ServiceNow since 2007. He is the founder and creator of SN | Guru and the co-founder of Crossfuze, one of the worlds leading ServiceNow consulting partners. Prior to co-founding Crossfuze, he worked for ServiceNow as a Senior Architect on the Professional Services team. He has personally led dozens of successful implementations encompassing every part of the ServiceNow platform. He is also responsible for designing and developing groundbreaking ServiceNow solutions and best practices in the form of various applications, turnkey solutions, and integrations during his tenure at ServiceNow, Crossfuze and, of course, SN | Guru. These solutions are used today by ServiceNow administrators and consultants alike in hundreds of ServiceNow instances around the world!

8 Comments

  1. Matt Gaide April 6, 2010 at 8:58 am - Reply

    Good update on this, although it would be very helpful if there was a dynamic way to define this as a variable in the future. Either by an attribute, some type of property… Not sure the best underlining approach for this, but I know that we have rolled out very few application in the system so far and this functionality being configurable like this would of been great.

    Matt

    • Mark Stanger April 12, 2010 at 8:17 am - Reply

      I agree. I know that this has been asked for before too. The best thing to do if you’d like to see this is to submit an enhancement request to the https://hi.service-now.com. The more people that ask for it, the more likely it is that it will be included as a feature in a future release.

  2. Matt Gaide August 9, 2010 at 3:19 am - Reply

    Looks like the time has come!
    Auto-complete for Reference Fields

    • Mark Stanger August 9, 2010 at 9:02 am - Reply

      This is an awesome improvement. I’ve contacted development about one drawback to the new solution currently. That is that you have to define the attributes for every single reference field that you want to use them on. What if you wanted to be able to do auto complete based on User Name or User ID? If you wanted this to be consistent across all reference fields you would have to update 260+ reference fields (which isn’t a good idea). I’ve contacted development with a proposal about this problem so we’ll see what comes. Just be aware that there are plusses and minuses to each solution currently.

  3. alli December 14, 2010 at 12:47 am - Reply

    Hi ,

    Does this work on Variables in service catalog?

    • Mark Stanger December 14, 2010 at 12:49 am - Reply

      The ‘Contains/Calculated field’ method will, the other one won’t. Catalog variables don’t support the same attributes that regular reference fields do.

  4. Dubey May 5, 2013 at 8:40 pm - Reply

    Hi,

    Could you please provide me the link mentioned above, I am not able open the URL.

    I have a requirement to have two reference field (User Table) on one form. One will display Employee ID and Other one will display User Name.

    Regards,
    Dubey

    • Mark Stanger May 6, 2013 at 6:47 am - Reply

      Just updated the link that was broken. I’m not sure that’s what you’re looking for though. I’ve never done 2 separate reference fields referring to the same piece of data. I think the best you could do in that case would be to have a second string field (or derived field) that would show the user name.

Leave A Comment