---
title: "Uncheck/Unselect an option"
canonical: "https://support.appfire.com/space/JMWE/462062041/Uncheck%2FUnselect%20an%20option"
format: markdown
---
> Macro (aura-html)

### Abstract

This code snippet unchecks a specific value <span style="color: #333333">of a standard or custom multi-valued type field (typically a </span>[multi-select field](https://appfire.atlassian.net/wiki/display/JMWEC/User+created+custom+fields)<span style="color: #333333">). </span><span style="color: #333333">The multi-valued fields can either be a collection of objects or a set of values. </span>While unchecking all is easy (set the field with a blank value), unchecking only a particular option/value requires code. 

### Logic

Iterate over the array of selected options and add them into a new array ignoring the option that needs to be unchecked.

### Snippet

#### For multi-select fields:

```groovy
//Retain all options ignoring the option that needs to be unchecked
def newValues = issue.get("<Name of the field>").findAll{
  it.getValue() != "<Value of the option to uncheck>"
}
return newValues
```

##### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Name of the field`> | Name of the field of type Checkboxes/Select list(multiple choices) | `Tasks list` |
| `<``Value of the option to uncheck``>` | Value of the option. | `Verification done` |

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

```groovy
//Retain all options ignoring the option that needs to be unchecked
def newValues = issue.get("<Name of the field>").findAll{
  it.getName() != "<Value to uncheck>"
}
return newValues
```

##### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Name of the field`> | Name of the multi-value field | `versions` |
| `<``Value to uncheck``>` | Value of the field. | `5.0.0` |

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

```groovy
//Retain all options ignoring the option that needs to be unchecked
def newValues = issue.get("<Labels field>").findAll{
  it.getLabel() != "<Label to remove>"
}
return newValues
```

##### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Labels field`> | Name of the Labels field | `Labels` |
| `<Label to remove>` | Label to be removed | `Merged` |

### Examples

<span style="color: #333333">The output of the code </span>is an array of objects <span style="color: #333333">which you could use in a Groovy expression </span><span style="color: #333333">to remove a particular option from the selected options of a field in </span>one of the Set Field Value post-functions and the Create issue post-function under Set fields of new issue section.

- <span style="color: #000000">Remove the reporter from the JIRA service desk customers</span>
- Clear the option "To Print" after the print has been generated
- Remove the label "Merged" when QA re-opens a ticket that has been merged into master and handed over to QA.

### References

- [Variables used in a Groovy expression](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461799437)
- [Issue interface](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461537734)
- [Accessing the fields of an issue](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461537562)
- [**Groovy Documentation**](http://groovy.codehaus.org/User+Guide)

### Related articles

> Macro (contentbylabel)

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