AnsweredAssumed Answered

Groovy asset tagging

Question asked by NZaky on Apr 16, 2013
Latest reply on Apr 16, 2013 by Parag Baxi

Working through some tagging issues and I figured I would post here so others could benefit:

 

Trying to tag items for which I did not generate a tag for. This excludes system generated tags. Basic use case is I have a Hierarchy:

 

  • Known OS Tag
    • Desktop Tag
      • Printers
      • Windows 7
      • Windows XP
    • Servers
      • Unix
      • Windows

 

 

 

There are more but you get the idea. My question then becomes "what am I missing" as the network and printer stuff is really off the wall. I created a dynamic tag called "Not Found" using the following Groovy scriptlet

"

return asset.tags.find{it.name == "Known OS Tag"}==null

"

...hoping that this will return anything not within my hierarchy listed above.  It is not working, and I think it is becuase the "Known OS Tag" is just a container that holds the other tags below it. I can go to the Assets tab and filter on that tag and it will return results that appear to be appropriate but I'm wondering if this is why my Groovy scriptlet is not working.

 

I'm doing more testing but if someone has a more elegant method for doing what I am trying to do I am all ears. Thank you

 

-Nick

Outcomes