how can we select a user by using his user ID and user email on reference field

vijani
Tera Expert

how can we select a user by using his user ID or user email on reference field.
It is Adhoc approval option in HR agent Workspace  


vijani_0-1721140185568.png

 

6 REPLIES 6

Sanjeev Kumar1
Kilo Sage

Hi vijani,

 

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!

 

SanjeevKumar1_0-1721140777538.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

 

https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/field-admini... 

 

Thanks,

SAI VENKATESH
Tera Sage
Tera Sage

Hi @vijani 

 

You can try the below One:

 

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=name,email,ref_ac_columns_search=true.

 

Thanks and Regards

Sai Venkatesh

 

Hi @SAI VENKATESH i tried with above but it did not work.

vijani_0-1721198256508.png

vijani_1-1721198374532.png

 

Sumanth16
Kilo Patron

Hi @vijani ,

 

The attribute section should read: ref_auto_completer=AJAXTableCompleter,ref_ac_columns=name,email,user_name,ref_ac_columns_search=true.

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
 
Thanks & Regards,
Sumanth Meda