The CreatorCon Call for Content is officially open! Get started here.

Search results don't match query in filter

Menna Kearns
Tera Guru

Currently on our INC tickets, we do not have an "on hold" state option in our dropdown. However, in a search for all INC tickets I add a filter for "on hold" and get a number of results. However, all the results are in the "resolved" state.  Any ideas why my query is returning results from a state I did not specify?

 

Thanks

7 REPLIES 7

Thanks for the links.  Our incident table extends the task table. I see that on the task table the On Hold label has a value of 6, and on the Incident table, Resolved has a value of 6. Could this be causing the issue?

 

My queries based on the link you provided:

https://xyz.service-now.com/sys_choice_list.do?sysparm_query=element%3Dstate%5ElabelSTARTSWITHOn%20H...

 

https://xyz.service-now.com/sys_choice_list.do?sysparm_query=element%3Dstate%5ElabelSTARTSWITHResolv...

 

Additionally, I do not get an "On Hold" option when attempting to filter from https://[instance_name].service-now.com/incident_list.do?sysparm_query=state%3D3&sysparm_view=

 

But I do get an "On Hold" option from https://[instance_name].service-now.com/task_list.do?sysparm_query=state%3D3&sysparm_view=

Menna Kearns
Tera Guru

I think I figured out what my issue is. I was running the search from the Filter Navigator on task_list.do (https://xyz.service-now.com/nav_to.do?uri=%2Ftask_list.do%3Fsysparm_query%3D%26sysparm_first_row%3D1...) and since the Incident table extends the Task table I get that task type in the results, and searching for "On Hold" returns "Resolved" as well as they have the same value (6) as I am technically running my query on the Task table. When I manually navigate to incident_list.do I no longer have an On Hold option.

 

Does this sound correct? Is there anyway to correct the search results so that if I run a query on the Task table and specify that the task type is "Incident", that "Oh Hold" will not return "Resolved" results?

 

Thanks again.

Bert_c1
Kilo Patron

Hello @Menna Kearns 

 

Please query sys_choice table with conditions 'element', 'is', 'state' and 'table', 'is one of', "task,incident".  As in the screenshot:

 

Screenshot 2023-04-11 141124.png

Notice those where value = 3.  Adjust your query according. I also get zero results when I query task as you posted.

 

https://[instance].service-now.com/task_list.do?sysparm_query=sys_class_name%3Dincident%5Estate%3D11&sysparm_view= 

 

There state value is '11', but the choice value as seen above is '3', Now if I query incident table for state = 'On hold'

 

https://[instance].service-now.com/incident_list.do?sysparm_query=incident_state%3D3&sysparm_view= 

 

we see the state value is 3.

 

See business rules that synchronze state values between 'state' and 'incident_state' fields.

 

https://[instance].service-now.com/sys_script_list.do?sysparm_query=GOTOcollection%3Dincident%5EnameLIKEstate%5EnameSTARTSWITHCopy&sysparm_view= 

 

I hope this helps.