---
title: "Checking the value of a multi-valued field"
canonical: "https://support.appfire.com/space/JMCF/465666318/Checking%20the%20value%20of%20a%20multi-valued%20field"
format: markdown
---
> Macro (aura-html)

### Abstract

This code snippet checks the value of a standard or custom multi-valued type field (typically a [multi-select field](https://appfire.atlassian.net/wiki/display/JMWEC/User+created+custom+fields)). The multi-valued fields can either be a collection of objects or a set of values.

### Logic

Iterate over the array of objects or set of values and check a specific field for the required value.

### Snippet 

#### For multi-select fields:

```groovy
//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>"}
```

##### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Name of the field>` | Name of the multi-select field | `Checkboxes` |
| `<Value of the field>` | Value of the option | Verification done |

#### **For **multi-versions/users/components/groups fields (e.g. Fix Version/s):

```groovy
//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>"}
```

##### Placeholders

| **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` |

#### **For **Labels field:

```groovy
//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>"}
```

##### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Name of the field`> | Name of the labels field | `labels` |
| `<Desired label>` | Label to find | `Use-case` |

### Examples

The output of the code is a boolean value (`true` or `false)`<span style="color: #333333"> which you could use to </span>

- Calculate and display a flag on the issue view screen if the issue has been flagged. For this, you will need to write a Groovy script to check that the issue has been Flagged and based on the result display a Flag using a Velocity template. See [here](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465633666) for the use case.

### References

- [Variables used in a Groovy expression](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465732169)
- [Issue interface](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465764748)
- [Accessing User-created custom fields](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465371725)
- [**Groovy Documentation**](http://groovy.codehaus.org/User+Guide)

###   
Related articles



> Macro (contentbylabel)

> Macro (details)
> 
> | **Related issues** |  |
> | --- | --- |