---
title: "Find the earliest unreleased version scheduled after a certain date"
canonical: "https://support.appfire.com/space/JMWE/461570962/Find%20the%20earliest%20unreleased%20version%20scheduled%20after%20a%20certain%20date"
format: markdown
---
> Macro (aura-html)

### Abstract

This code snippet finds the earliest unreleased version scheduled after a certain date

### Logic

<span style="color: #333333">Access the available versions for the issue and finds the earliest unreleased version scheduled after a certain date</span>

### Snippet

```javascript
def version
issue.getAvailableOptions("versions").each{
  if(!it.isReleased() && it.getReleaseDate() >= issue.get("<Specific date>") && (version?.getReleaseDate() == null || version.getReleaseDate() > it.getReleaseDate())) 
  {
    version = it
  }
}
version?.getName()
```

### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Date field name>` | Name of the field of type Date | `duedate` |

### Examples

The output of this snippet is a [String](https://docs.oracle.com/javase/7/docs/api/java/lang/String.html) representing the *name* of a Version which you can use in a Groovy expression, for example, to set the Fix Version/s <span style="color: #172b4d">of an issue to the earliest unreleased version </span><span style="color: #172b4d">scheduled after the Due date</span> in:

- one of the Set Field Value post-functions
- the Create issue post-function under Set fields of new issue section

### References

- [issue interface](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78055921)
- [getAvailableOptions()](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78053666)
- [Version interface](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78055714)
- [**Groovy Documentation**](http://groovy.codehaus.org/User+Guide)

### Related articles

> Macro (contentbylabel)