TUESDAY, FEBRUARY 07, 2012

Multiple Reference Display Values Per Table

W

hen 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 dropdown 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

Comments

Posted On
Apr 06, 2010
Posted By
Matt Gaide

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

Posted On
Apr 12, 2010
Posted By
Mark Stanger

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.

Posted On
Aug 09, 2010
Posted By
Matt Gaide
Posted On
Aug 09, 2010
Posted By
Mark Stanger

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.

Posted On
Dec 14, 2010
Posted By
alli

Hi ,

Does this work on Variables in service catalog?

Posted On
Dec 14, 2010
Posted By
Mark Stanger

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

Leave a Reply


Notify me of followup comments via e-mail. You can also subscribe without commenting.

Latest Comments

  • Mark Stanger: This linkage all happens for you if you use the task survey plugin. You can look on the wiki for more...
  • Vineeth: I want a way in which if a survey is filled in by the user the response are stored in the survey response...
  • Mark Stanger: This functionality doesn’t connect to an FTP server. See this line in the post above…...
  • Mark Stanger: The report page is back-end XML so there’s no way to directly manipulate the behavior of that...