How do I get all available tags in a workflow rule?

I am creating a workflow rule, and I would like to see if a tag exists in the current project with a certain name. There doesn't seem to be a way to do this. The closest I can come is this:

var tag = loggedInUser.getSharedTag(word);
if( tag == null ) {
  tag = project.getUser("root").getSharedTag(word);
}
if( tag == null ) {
  tag = loggedInUser.getTag(word, false);
}
if( tag == null ) {
  tag = project.getUser("root").getTag(word, false);
}

if(tag == null) {
  message("no tag found for " + word);
} else {
  message("tag FOUND for " + word);
}

But this will miss tags created by other users. project.valuesFor(tags) doesn't work, as it doesn't see tags as a field.

What am I missing here?
1 comment
Comment actions Permalink
Tags in YouTrack have a user level. So you cannot get all tags but only user own or shared tag.
If you want to get tags of users of some group you can iterate by users:

for each user in {group: New Users}.getUsers() { 
  user.getTag("word", false); 
}
prettyPrint();
0

Please sign in to leave a comment.