This code snippet checks the value of a standard or custom multi-valued type field (typically a multi-select field). The multi-valued fields can either be a collection of objects or a set of values.
Iterate over the array of objects or set of values and check a specific field for the required value.
//Run a loop on all the selected options of the field and find the desired option issue.get("<Name of the field>").any{ it.getValue() == "<Value of the field>"} |
Placeholder | Description | Example |
---|---|---|
| Name of the multi-select field |
|
<Value of the field> | Value of the option | Verification done |
//Run a loop on all the selected options of the field and find for the desired object issue.get("<Name of the field>").any { it.getName() == "<Name of the desired version>"} |
Placeholder | Description | Example |
---|---|---|
<Name of the field > | Name of the multi-valued version field | fixVersions |
<Name of the desired version> | Name of the version to find | 2.0 |
//Run a loop on all the selected labels of the field and find for the desired label issue.get("<Name of the field>").any { it.getLabel() == "<Desired label>"} |
Placeholder | Description | Example |
---|---|---|
<Name of the field > | Name of the labels field | labels |
<Desired label> | Label to find | Use-case |
The output of the code is a boolean value (true
or false)
which you could use to conditionally execute a Post-function/Condition/Validator or Unlink issues:
Check the issue has been flagged
issue.get("Flagged").any { it.getValue() == "Impediment"} |
Check the issue has a label Server
issue.get("Labels").any { it.getLabel() == "Server"} |
Check the issue has 5.0.0
as an Affects Version/s
issue.get("versions").any { it.getName() == "5.0.0"} |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|