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

Hi Michael & Chuck,



Thanks for pointing me towards the OOB UI Page, named 'generic_hierarchy_erd'. I did modify the UI Page a bit just adding the an extra column to test it, but no luck.



<g:ui_reference id="item_picker" name="item_picker"


query="element=null^language=${gs.getUser().getLanguage()}"


table="sys_documentation"


value=""


displayValue=""


columns="name;label"


columns_search="true"


order_by="name"


show_popup="false"


completer="AJAXTableCompleter"/>


out of curiosity, did you try



columns="name,label"



??


Yes Chuck, I did try that too. But no luck!


Community Alums
Not applicable

Thanks, it worked perfectly on UI page. 
You need to add more field name on columns part that's it.

I hope michael.ritchie or ctomasi can answer this one; is there a way to make any of the above work in the app för a Record Producer variable reference field pointing at sys_user?



We're creating a quick case option, but it won't be that quick if the onsite technician will have to guess which of the 10 people with the same name they are currently helping. Would help a lot just to show email address or username, as well as names.



The app not included, the different attributes are great for ref.fields in different forms. That and a properly configured tree view.



Regards


Anton