Changes to working with Tags in Automation Rules
The fixes will be rolled out to all public clouds in the beginning of April, 2020
We have fixed a couple of very annoying bugs concerning Tags in Automation Rules, which means that the way of working with Tags is changed to be more logical and consistent.
Using Previous and Current Tags in Filters
Let's take a look at the following Automation Rule
![Rule tag filter.png 812](https://files.readme.io/ffa3a77-Rule_tag_filter.png)
Basically what we're trying to achieve with this rule, is to do an action when a Tag use is added to some Request. For a start we'll be testing it with a Request that already has one tag: merged. To trigger the rule, we'll add one more Tag to it: use.
![Add tag.png 495](https://files.readme.io/7a798bf-Add_tag.png)
Before the fix: the action is performed
After the fix: the action is performed
Now we'll take the same Request that already has two tag: merged and use. We'll remove the Tag use.
![Remove tag.png 564](https://files.readme.io/7785e68-Remove_tag.png)
Before the fix: the action is performed. This was NOT correct behavior.
After the fix: the action is NOT performed
And the last test will with a Request that does not yet have Tags in it. To trigger the rule, we'll add one more Tag to it: useless.
![Add useless.png 488](https://files.readme.io/0642cd9-Add_useless.png)
Before the fix: the action is performed. This was NOT correct behavior.
After the fix: the action is NOT performed
What if you actually wanted to filter by a part of a Tag?
If you'd like to conserve the old behavior, please use the following Javascript filter instead of UI filter:
return args.Current.Tags.includes("hotfix");
Herehotfix
will be a part of a Tag you're looking for, so all the Tags likehotfix 2.0
will match this filter.
Using Previous and Current Tags in Actions
Let's take a look at the following Automation Rule
![Rule test.png 807](https://files.readme.io/ee85df9-Rule_test.png)
We'll be testing it with a Request that already has one tag: merged.
To trigger the rule, we'll add one more Tag to it: useless.
![Request.png 555](https://files.readme.io/e2454aa-Request.png)
Before the fix:
In args.Previous.Tags
we have nothing. This field is empty.
In args.Current .Tags
we have a combination of Previous and Current Tags: "merged ,merged ,useless".
The tags are joined with a space and a comma.
After the fix:
In args.Previous.Tags
we have only Previous Tags: "merged"
In args.Current .Tags
we have only Current Tags: "merged, useless".
The tags are joined with a comma and a space.