Logical expression in JWT Cloud are built the same as in JWT DC. However, besides the general differences concerning field codes (see Migrate field codes) and parser functions (see Migrate JWT Parser functions) there are also slight differences in the logical parsing mode. They are explained below.
In JWT DC so-called multi-valued fields are treated as lists (and not as simple text) when using the following logical operators :
Operator JWT DC | Meaning |
---|---|
any in | any element is in |
none in | no single element is in |
any in~ | any element is in (case-ignoring) |
none in~ | no single element is in (case-ignoring) |
That means that in JWT DC it is possible to write expressions like
%{issue.versions} in %{issue.fixVersions}
In JWT Cloud, this notion is not available. An expression dealing with such a multi-valued field has to be migrated by embedding the field code in the function toStringList (or toNumberList, respectively).
The following fields are considered multi-valued fields:
- Affects version/s
- Attachments
- Available target statuses
- Available transitions
- Component/s
- Component/s leads
- Fix version/s
- Labels
- Watchers
- Custom fields
- Select List (Multiple choice)
- Checkboxes
- Labels
- User picker (multiple users)
- Group picker (multiple groups)
- Version picker (multiple versions)
Migration of multi-valued fields in logical expression: Apply the function toStringList() to the respective field.
Examples
JWT DC expression | JWT CLoud expression |
---|---|
%{issue.versions} none in %{issue.fixVersions} | toStringList(%{issue.versions}) none in toStringList(%{issue.fixVersions}) |
%{issue.labels} any in ["Backend", "Frontend"] | toStringList(%{issue.labels}) any in ["Backend", "Frontend"] |
In JWT DC, some case-ignoring operators are available (for details please see the respective part in the description of JWT DC's Logical mode). They are not available in JWT CLoud.
Operator JWT DC | Meaning |
---|---|
=~ | equal to |
!=~ | not equal to |
~~ | contains |
!~~ | does not contain |
in~ | is contained in |
not in~ | is not contained in |
any in~ | any element is in |
none in~ | no single element is in |
As a work around you can use the functions toUpperCase()/toLowerCase() for both operands and use the respective case sensitive operator. If an operand is a List, it first has to be converted to a text first using toString().
Examples
JWT DC expression | JWT Cloud expression |
---|---|
"HELLO" =~ "Hello" | toUpperCase("HELLO") =~ toUpperCase("Hello") |
%{issue.lables} ~~ ["Backend","Database"] | toLowerCase(%{issue.labels}) =~ toLowerCase(toString(["Backend","Database"])) |