How to make Search Screen filter use contains instead of starts with.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2023 10:55 AM
I have recently discovered _search.do. If I enter incident_search.do in the Application/Filter Navigator, ServiceNow shows me a special form view of the incident table with a Search button. I can fill out the form and press the Search button to load a list view of incidents. The filter applied to the list view will match the fields I filled out on the form.
The problem I am having is that I cannot choose how the filter will match the values I entered in the form. The filter will always use "starts with". For example, if I fill out the Number field, the resulting filter will look like "numberSTARTSWITHINC000001". But what if I want it to use "contains" instead? I can't figure out a way to tell the Search Screen to use "contains" instead of "starts with".
Does anyone know how to achieve this? I was hoping it might be done with URL parameters, but the only two parameters I know that I can feed the Search Screen are sysparm_view and sysparm_result_view. I am open to other ways of achieving this as well and any information you may have regarding Search Screens. Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2023 12:09 PM
Hi fpoth,
Sure, it looks like it is using the default operators, so starts with for String fields and ends with for Integer fields.
Once you get the result, click on the Filter icon (funnel) and change the operator to Contains.
You may also type incident.filter and use the Filter icon to add all the conditions you want.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2023 12:26 PM
Thank you, @JP - Kyndryl! That is all very useful to know. Could you give me more information on the "default operators" you mentioned? Is there a way to set the default operators used for each type of field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2023 02:57 PM
Sorry, cannot find where these defaults are controlled.
The form has a Search button, so I checked the UI Action "Search" but it does not contain a script and says "Actual processing is handled in a java transaction handler".
So it looks like this processing is pretty internal and we will surely not be able to modify.
I also checked the system properties and could find one that may control this default behavior.
JP