How can I change the default search on a list collector to search on 'contains'?

nortonxnorris
Giga Expert

I have a list collector of software's. I would like the search pull the values based on 'contains' rather than 'starts with'.

Where do i make this change?

1 ACCEPTED SOLUTION

Jon23
Mega Sage

You should be able to use this: Auto-Complete for Reference Fields - ServiceNow Wiki


10 Contains Auto-Complete Search

By default, the reference auto-complete uses a starts with search. A user preference can be created to implement a contains search.


To use the contains search:


  1. Disable the glide.ui.ref_ac.startswith system property . See Improving Auto-Complete Queries.
  2. Navigate to User Administration > User Preferences.
  3. Select the preference "'<referenced table>.autocomplete.contains"'.
  4. Set the value field to true.
  5. Log out and log back in to immediately display the updated search.

AutocompleteContains1.png


Note


Note: Setting the glide.ui.ref_ac.startswith system property to true overrides any existing "autocomplete.contains" settings in both user and system level preferences. This property changes the autocomplete query method for all users regardless of preferences.

View solution in original post

5 REPLIES 5

Jon23
Mega Sage

You should be able to use this: Auto-Complete for Reference Fields - ServiceNow Wiki


10 Contains Auto-Complete Search

By default, the reference auto-complete uses a starts with search. A user preference can be created to implement a contains search.


To use the contains search:


  1. Disable the glide.ui.ref_ac.startswith system property . See Improving Auto-Complete Queries.
  2. Navigate to User Administration > User Preferences.
  3. Select the preference "'<referenced table>.autocomplete.contains"'.
  4. Set the value field to true.
  5. Log out and log back in to immediately display the updated search.

AutocompleteContains1.png


Note


Note: Setting the glide.ui.ref_ac.startswith system property to true overrides any existing "autocomplete.contains" settings in both user and system level preferences. This property changes the autocomplete query method for all users regardless of preferences.

Thank you!


tonvanoostveen
Tera Contributor

Thanx!!

The ServiceNow documentation is unclear on this contains search configuration.
The ServiceNow doc examples only shows a contains user preference on the "sys_user" table ("sys_user.autocomplete.contains" so I assumed, this would enable the contains search on any table..).

With this in mind I totally overlooked the <referenced table> part in your, item 3.
Maybe to improve on this you can add between 2 and 3: "Create a NEW User Preference".
So for any other user struggling with this "contains" search be sure you add your table into the User Preferences section by creating a New User Preference, as mentioned above:


<YOUR_TABLE_WHERE_YOU_WANT_TO_ENABLE_CONTAINS_SEARCHES>.autocomplete.contains

Unfortunately I am unable to update my original response with your helpful suggestion.  Hopefully anyone who reads this thread will also see your comment.

Please review the latest documentation to be sure my (5+ year) response copied from the wiki is still a relevant solution for your needs.  Auto-complete for reference fields [Orlando]