The CreatorCon Call for Content is officially open! Get started here.

List attributes beyond name for user reference fields

jonathanstewart
Tera Contributor

Looking for a way to display additional information about a user record in a lookup beyond the name of the user.  I have many users that have the same name but other distinguishing characteristics that would help users make the correct selection.

1 ACCEPTED SOLUTION

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Yes this is definitely possible.   Here are some instructions I had put together for some peers of mine.   This use case was to use employee ID as a search criteria, but you don't have to do that.  




Use Case: I would like to search for callers by several attributes and not just by their name.   OOB the user can click the magnifying glass beside the reference field and search that way, but it requires extra clicks and time.   Fortunately ServiceNow can display other data on the Type Ahead popup and that data is also searchable!


find_real_file.png



Notice above I am not only showing the employee's name, but also the first and last name as well as the employee number of that user.


·                 You can also set it up where you search all the columns you are displaying.   This comes in handy if the users want to be able to search on first name, last name, or employee ID all in the same field.   Also notice above, I typed in "111" and it searched both the employee ID column and presented several results where the employee number starts with "111".   I could have also typed in "smi" to get the same results.


·                 This especially comes in handy with locations and wanting to search for a city or state or location code/number.



This is also very easy to configure with the steps below:


  • Now I mentioned above to make sure the "number" field is a string value, the reason I mentioned this is because if you want to allow searching in all columns it must be a string type column.   Numbers, email, etc aren't searchable.
  • To set this up, you personalize the dictionary on the particular field — this is done on a field by field basis so you may need to do this multiple times.   So for example, to make the above work for the incident caller, right click on the Caller label and choose Personalize Dictionary.   Then:
    • Make sure you are on the Advanced View — under Related Links you may see "Advanced view" so click that if it shows up.
    • On the Advanced view you will see a field called Attributes.   OOB the value of this field is: ref_contributions=user_show_incidents
    • You will need to add a few new attributes which are always separated by commas, then paste in the following:
    • ref_ac_columns_search=true,ref_auto_completer=AJAXTableCompleter,ref_ac_columns=first_name;last_name;employee_number
      • Here is an explanation on what these mean:
        • ref_contributions=user_show_incidents — this shows the UI Macro that shows all the caller's incidents
        • ref_ac_columns_search=true,ref_auto_completer=AJAXTableCompleter — these allow the searching to happen
        • ref_ac_columns=first_name;last_name;employee_number — this is how you set what additional columns appear.   In this example I am showing the first and last name and employee number.   You must enter the database column name, not the label.   You can certainly add additional ones by separating them with a semicolon.
  • The end result Attributes value will be:
  • ref_contributions=user_show_incidents,ref_ac_columns_search=true,ref_auto_completer=AJAXTableCompleter,ref_ac_columns=first_name;last_name;employee_number


View solution in original post

40 REPLIES 40

edwajs
ServiceNow Employee
ServiceNow Employee

Hi Rory,


The Catalog Variable equivalent of a glidelist field is a List Collector variable where you specify a GlideList attribute.


This converts the List Collector from the slushbucket format into a GlideList format.


Hi michael.ritchie ,



Just a follow up question to clarify my idea on this in deep. Is it possible to accommodate ref_ac_columns attribute in the UI Page?



I'm using <g:ui_reference/> tag in the UI Page, similar to this examples . Is it possible to to add the same feature, what ref_ac_columns attribute provides on field (Reference type) level, in the UI Page when the user wants to search out by typing something apart from the Display value of the table?



I have gone through the OOB UI Macro 'ui_reference' which doesn't include the same attribute. As per Chuck's reply in this thread, Field attributes on UI Page , UI Page might not support all attributes. But is there any workaround of the same? Or am I missing any?



Thanks in Advance!


Unfortunately I am not a strong Jelly coder so unsure how to implement this in a UI page.   Maybe ctomasi can provide further guidance.


According to the Description field on the ui_reference macro, it does take a completer parameter.



Creates a selector showing records from a specified table.



Attributes:


name= what you want to name the select


table= the table from which you will select


value= the initial value for the select (may be omitted if nothing is initially selected)


show_popup= true/false whether the popup icon is displayed


show_lookup=true/false for lookup list to display the magnifying glass or not


completer= set to another completer class if you do not want AJAXReferenceCompleter (for example, AJAXTableCompleter)



If you are using completer=AJAXReferenceCompleter, you can also use:


columns= if you want to show additional columns in the drop down (semicolon separated list)


order_by= if you want to sort matches in the drop down by a particular column


query= if you want to limit the results (for example, active=true)


Hi Chuck,



So, can't we use the search lookup functionality using other columns of a specified table when we use <g:ui_reference/> tag in the UI Page? If not, is there any alternative solution of having the functionality similar to ref_ac_columns attributes?