Keyword Based Search In Reference Variables

priyanshp4
Tera Contributor

Dear Community,

I am looking for some help regarding a Catalog Item. We have a Reference Variable that points to Software Models. When users search for software models from the catalog, the reference lookup is not performing a keyword-based search. Instead, it only returns records where the value starts with the entered text.


ref_auto_completer=AJAXTableCompleter,

ref_ac_columns=display_name,

ref_ac_columns_search=true

Has anyone encountered this issue before or knows if there are additional configurations, system properties, or settings required to enable true keyword-based searching for reference variables in ServiceNow?

4 REPLIES 4

Brad Bowman
Mega Patron

It sounds like you want to do a 'contains' query.  See the section entitled "Improve auto-complete queries" and the ones following it.

https://www.servicenow.com/docs/r/platform-administration/c_AutoCompleteForReferenceFields.html 

pr8172510
Kilo Sage

Hi @priyanshp4 ,

I was able to reproduce this issue and successfully test contains-based autocomplete for a Software Models reference variable in a ServiceNow Catalog Item.

I created a demo Catalog Item named Software Model Search Demo with the following configuration:

Reference variable

  • Type: Reference

  • Reference table: cmdb_software_product_model

  • Variable attributes:ref_auto_completer=AJAXTableCompleter,ref_ac_columns=display_name,ref_ac_columns_search=true

System property

glide.ui.ref_ac.startswith = false

User preference

cmdb_software_product_model.autocomplete.contains = true

 

 

Search for Acrobat

The autocomplete returned:

  • Adobe Systems Acrobat DC Professional

  • Adobe Systems Acrobat DC Standard

    pr8172510_0-1792591475467.png

     

     

 Search for robat

The autocomplete returned the same two records, even though the search term occurs within the word Acrobat.

pr8172510_1-1792591518147.png

 

pr8172510_2-1792591544049.png

 

pr8172510_3-1792591563636.png

 

pr8172510_4-1792591588938.png

 

 

 

 


https://www.servicenow.com/docs/r/platform-administration/c_AutoCompleteForReferenceFields.html

 

So in other words, you followed the link I posted hours earlier, then posted the same link?

yashkamde
Giga Sage

Hello @priyanshp4 ,

 

Yes, By default, reference field and variable lookups use a starts-with search. To get a contains (keyword-based) search, you need to enable it using below steps :

  1. Set the system property glide.ui.ref_ac.startswith to false.
  2. Navigate to User Administration > User Preferences
  • Name: <referenced table name>.autocomplete.contains.
  • Type: string
  • Value: true
  • System: checked

Refer Below :

On a Catalog Form, there is a Reference variable. But it gives poor search accuracy. What to do? 

How to configure a "contains" search for a table 

 

If my response helped mark as helpful and accept the solution.