Maik Skoddow
Tera Patron

find_real_file.png

 

I love the tag feature of ServiceNow because you can simply mark any records and thus map search scenarios that would not be possible with normal search filters.

In most cases, it is enough to search for specific tags. But what if you search the other way round, i.e. 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.

 

MaikSkoddow_0-1682908245010.png We start at the list of all Instance Scan checks with an empty filter and a result list of 621 records.
MaikSkoddow_1-1682908375316.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.
MaikSkoddow_2-1682908446704.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.

MaikSkoddow_3-1682908759258.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

MaikSkoddow_4-1682909202300.png

After hitting ENTER the search result should only list all records without the excluded tag (now 593 instead of 68 records before).

 

If you right-click on the filter breadcrumbs and then select "Copy query" you will get the correct representation of the query for the further use in your scripts.

Comments
Rita Inacio
Tera Contributor

Hello,

thank you for your post, it was helpulf.

But unfortunately, in my case, once there is other assigned tags to the incident records, the result is not the expected. the expected result is to get all the records that doesn't have that tag, but can have others.

Do you have any other option to do this?

I am trying to use it with other filters.

Thank you.

 

Rita 

 

Maik Skoddow
Tera Patron

Hi Rita,

thanks for your reply and nice to hear that it was helpful. And of course I would be very pleased if you could reward this with a click on "Helpful" 🙂

And to answer your question: 
I'm afraid this is not possible with standard means, but with a script approach it should.

Kind regards
Maik

 

Sebastian R_
Kilo Sage

@Maik Skoddow looks like this is now possible using the report builder. I could not figure out the difference between "excluding" and "does not have" but it is also working if you have another tag set.

SebastianR__0-1704356471534.png

SebastianR__1-1704356566576.png

See also https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0955840

Maik Skoddow
Tera Patron

@Sebastian R_ 

Thanks for the information. Was not aware of this. But at the end I need this capability in the list view and not in den report builder. 😞

Maik

Swetham
Tera Contributor

Hi @Maik Skoddow ,

 

There are no three dots to apply quick filter on tags in compliance workspace. Any inputs reg the same would be much appreciated.

 

Kind Regards.

Jeff R_
Giga Expert

Give this a try.  Instead of placing the exclamation point in front of the coded "=", try replacing it totally with "EXCLUDING".  So step 4 above would now be:

 

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

TOTALLY REPLACE THAT EXPRESSION WITH "EXCLUDING":

ORsys_tags.a81628fc97266110b05bb08fe153afe4EXCLUDINGa81628f

 

Using this, you no longer need the "tag is blank" OR condition in their either.  Seemed to work for me.  Not sure if it's exactly what you're looking for tho.  Good luck!

Version history
Last update:
‎04-30-2023 07:53 PM
Updated by:
Contributors