Removing tag with the workflow
Hello,
I'm using the workflow to add and remove tags on issues related to a particular one depending on the state of that particular issue.
That works great for me (root) the creator of all tags.
But for others (even if I give them all the rights) adding tags works but removing them does not.
All the tags are visibles and can be updated by everyone.
Is their something I am missing ?
Thanks in advance
I'm using the workflow to add and remove tags on issues related to a particular one depending on the state of that particular issue.
That works great for me (root) the creator of all tags.
But for others (even if I give them all the rights) adding tags works but removing them does not.
All the tags are visibles and can be updated by everyone.
Is their something I am missing ?
Thanks in advance
Please sign in to leave a comment.
This should be working for other users as well. We need some more info to investigate the issue. What kind of WF rule are you referring to? Could I ask you to provide us with the entire workflow?
Regards,
Alexander
please pay attention that it's needed to use tag reference (e.g. {tag: tagname}) but not tag name as parameter.
Look at the JT-18880 for details.
thanks for the lead, unfortunately it didn't worked after trials and errors I have the following code
rule toDeliverForLinked when hasTag("Livraison") { if (State == {In Progress}) { for each relates in relates to { relates.addTag("En livraison"); for each tag in tags { if (tag.name == "A livrer" || tag.name == "Livré") { tags.remove(tag); break; } } /* relates.removeTag("{tag:A livrer}"); */ /* relates.removeTag("{tag:Livré}"); */ } } else if (State == {Fixed} || State == {Done}) { for each relates in relates to { relates.addTag("Livré"); for each tag in tags { if (tag.name == "A livrer" || tag.name == "En livraison") { tags.remove(tag); break; } } /* relates.removeTag("{tag:En livraison}"); relates.removeTag("{tag:A livrer}"); */ } } else { for each relates in relates to { relates.addTag("A livrer"); for each tag in tags { if (tag.name == "En livraison" || tag.name == "Livré") { tags.remove(tag); break; } } /* relates.removeTag("{tag:En livraison}"); relates.removeTag("{tag:Livré}"); */ } } }and neither the
nor the
relates.removeTag("{tag:Livré}");works.
Looks like my issue is close to this one : http://youtrack.jetbrains.com/issue/JT-16275#
Regards
Yann
Also, relates.removeTag("{tag:Livré}"); definitely won't work, expected to use relates.removeTag({tag:Livré});, without quotes, as parameter, but it actually can don't work because of the mentioned bug JT-16275.
Try to use the alternative direct method tags.remove().
so I changed my code to be:
rule toDeliverForLinked when hasTag("Livraison") { if (State == {In Progress}) { for each relates in relates to { relates.addTag("En livraison"); for each tag in tags { var tag_name = tag.name; if (tag_name.eq("A livrer", ignoreCase) || tag_name.eq("Livré", ignoreCase)) { tags.remove(tag); break; } } } } else if (State == {Fixed} || State == {Done}) { for each relates in relates to { relates.addTag("Livré"); for each tag in tags { var tag_name = tag.name; if (tag_name.eq("En livraison", ignoreCase) || tag_name.eq("A livrer", ignoreCase)) { tags.remove(tag); break; } } } } else { for each relates in relates to { relates.addTag("A livrer"); for each tag in tags { var tag_name = tag.name; if (tag_name.eq("En livraison", ignoreCase) || tag_name.eq("Livré", ignoreCase)) { tags.remove(tag); break; } } } } }I have the same issue, can I do something similar without using the tags ?
Regards
Yann
Let's reduce the problem. So, please write the simple workflow to make sure that basically tags are removed:
rule tag removing when Priority.changed { tags.remove({tag: 123}); }If it works we have find the other incorrect code in the workflow.
I created a new rule associated it to a project and created a new tag 123 available for everyone, when the rule is applied I have the following error :
In the youtrack editor the rule does not validate I have the following No children in role "element" (declared cardinality is 1)
I finally got it to work with the following
rule toDeliverForLinked when hasTag("Livraison") { if (State == {In Progress}) { for each relates in relates to { relates.addTag("En livraison"); relates.tags.remove({tag: Livré}); relates.tags.remove({tag: A livrer}); } } else if (State == {Fixed} || State == {Done}) { for each relates in relates to { relates.addTag("Livré"); relates.tags.remove({tag: En livraison}); relates.tags.remove({tag: A livrer}); } } else { for each relates in relates to { relates.addTag("A livrer"); relates.tags.remove({tag: En livraison}); relates.tags.remove({tag: Livré}); } } }I realized that when I switched from removeTag to remove I forgot the relates, stupid me.
Thanks for all.
Regards
Yann