How do I find all services that don't have a specific tag?

Robert Campbell
Tera Guru

I am trying to filter services that don't have a specific tag. I have a list of ids but of those ids I want to see which don't have a tag "ABC"

 

I use a filter of CI ID is one of (100+). But because I have so many it creates a short url. If I do just 5 or so, I can see the url and add a '!' to the filter representing "Tag != ABC" but because there are so many, I cannot do that. Any suggestions?

2 REPLIES 2

swapnali ombale
Kilo Sage

Hi @Robert Campbell 

find all records that do NOT have a certain tag?

With the OOTB possibilities of the filters one does not come here further, however there is a trick.

 

swapnaliombale_0-1744226945745.png

 

We start at the list of all Instance Scan checks with an empty filter and a result list of 621 records.
swapnaliombale_1-1744226945764.png

 

The next step is the most important: You have to select two times the Tags criteria and combine them with an OR condition:

  1. one time with an empty value and
  2. one time with the Tag that should be excluded later.
swapnaliombale_2-1744226945960.png

 

The result set is the same as before, and the filter breadcrumbs reflect the configured search.

 

The next step is to reverse the search query.

swapnaliombale_3-1744226946782.png

 

 

For that step examine the query part of the URL parameters (sysparm_query).

The interesting part here is the double URL-encoded presentation of an equals sign: %253D

Right before that expression, insert an exclamation mark which represents the negation of the following expression:

ORsys_tags.a81628fc97266110b05bb08fe153afe4!%253Da81628f

swapnaliombale_4-1744226945791.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

I have 1469 CI_IDs and the query is:
CI ID is one of ...

&&

Tag is not "In scope".

 

Because I have is one of, I'm not able to do the suggestion because it creates a tiny url.