Populate User ID in List Collector Field

Piyush27
Tera Contributor

Hi,

 

I am trying to see users when entering the user id in a list collector variable.

 

The list collector variable is pointing to the sys_user table. Below is the screenshot of the variable.

----------------------------------------------------------------

Piyush27_0-1681909186775.png

-------------------------------------------------------------------------

Piyush27_1-1681909256306.png

-----------------------------------------------------------------------------

This is how the catalog item looks on the portal

Piyush27_2-1681909328581.png

------------------------------------------------------------------------------

 

What I want here is - When I enter the USER ID in the field it should show only the USER IDs.

But in my case, I have to type the complete name.

 

Is there any way I can achieve this?

 

Regards,

Piyush

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Piyush27 I am assuming you would like to have the search performed on the user_name field like the following.

 

Screenshot 2023-04-19 at 7.08.04 PM.png

Here when I am typing admin, it has suggested me the user with user_name admin.

 

In order to achieve this you need to paste the following string inside your Variable attributes of your user list collector variable.

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=user_name,ref_ac_order_by=user_name,ref_ac_columns_search=true,ref_ac_display_value=false

Screenshot 2023-04-19 at 7.11.05 PM.png

 

Hope this helps.

View solution in original post

8 REPLIES 8

@Piyush27 

I believe your original question and the answer marked as correct are different.

You wanted to see User ID when you type the information and also when the value is set in variable.

For that did you check my above response?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@Piyush27 

Try to add the variable attribute which Sushant has shared.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Brian Lancaster
Tera Sage

You can try modifying the dictionary on the sys_user table in the following way.

1. Go to the users table

2. right lick and choose 

BrianLancaster_0-1681910814070.png

3. Soft by Column name. The first one should have a blank column name. open this record

4. Update the reference auto completer columns to include user_name. It should look something like this.

BrianLancaster_1-1681911500712.png

This should allow you to search based on user id but it will still display full name. Unless you change the display value with a dictionary override name is the default display value. Changing this would not be recommended as it would change it in the entire system anywhere you reference the sys_user table.

Sandeep Rajput
Tera Patron
Tera Patron

@Piyush27 I am assuming you would like to have the search performed on the user_name field like the following.

 

Screenshot 2023-04-19 at 7.08.04 PM.png

Here when I am typing admin, it has suggested me the user with user_name admin.

 

In order to achieve this you need to paste the following string inside your Variable attributes of your user list collector variable.

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=user_name,ref_ac_order_by=user_name,ref_ac_columns_search=true,ref_ac_display_value=false

Screenshot 2023-04-19 at 7.11.05 PM.png

 

Hope this helps.