How can I set a catalog reference variable up to use a CONTAINS search rather than a BEGINS search?

Nathan Underwoo
Tera Expert

I have a catalog reference variable that I'm using as a form field for users to select an application from. The table itself is fairly small and I don't expect it to be bigger than a few hundred records in the long term. I would like users to have their search terms use a CONTAINS search rather than a BEGINS search by default. I've tried using the variable attributes beginning with ref_* but I was unable to come up with a working combination that does what I want. So far the only thing I seem to be able to do to make it work is to place an asterisk in front of my search term as I am using it. This isn't a great solution because this is a form that every user will need to use and not everyone is going to know that (or understand it even if we add some kind of annotation to indicate it can be done). It would be much simpler if I could just make this one field act as a CONTAINS search. I do know that there is a global property that controls this but I do not want to make a global change.

1 ACCEPTED SOLUTION

Mark Stanger
Giga Sage

You can't do this for a single field.  It's the global property per table or nothing.  I've done this type of thing before by including an automatically-expanded help text section explaining to users how the '*' will work for a contains search.

Please mark this response correct if I've answered your question.  Thanks!

View solution in original post

7 REPLIES 7

Mark Stanger
Giga Sage

You can't do this for a single field.  It's the global property per table or nothing.  I've done this type of thing before by including an automatically-expanded help text section explaining to users how the '*' will work for a contains search.

Please mark this response correct if I've answered your question.  Thanks!

Shane J
Tera Guru

If you do decide to go global...

I've got a Reference variable to sys_user using the following attributes:

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=user_name;department,ref_ac_columns_search=true

And there's info here about setting up contains:

https://docs.servicenow.com/bundle/london-platform-administration/page/administer/field-administration/concept/c_AutoCompleteForReferenceFields.html#t_ContainsAutoCompleteSearch

Nathan Underwoo
Tera Expert

I've opened an enhancement request because it appears (as I initially suspected) that there is no option to do this for a specific field. Hopefully they will see the value and consider it.

Hi Nathan,

I am looking for a same functionality in my record producer, do we have a way to this now? Did you get response to your enhancement request?