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

sushantmalsure
Mega Sage
Mega Sage

Hello @Piyush27 

i think you need to add variable attributes in that variable

Like for autocompletion you can use : ref_auto_completer=AJAXTableCompleter

you can refer all the variable attributes in following link for more details:

https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/product/service-catalog-management...

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

Hi Sushant,

 

I tried but it is not working.

 

Piyush27_0-1681911949128.png

What I want when I enter USER ID only that should populate in the list collector variable (field) 

Did you try mine solution?

@Piyush27 

It won't show User ID once you select the record.

Reason: On user table name field is Display=true so it will show only Name

to show user ID you need to mark User Name field as Display=true in sys_user table

Note: This will be a global change and impact every reference field which refers to User table in entire instance. So discuss this with your customer before doing that.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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