---
title: "Find the next unreleased version"
canonical: "https://support.appfire.com/space/JMWE/461701863/Find%20the%20next%20unreleased%20version"
format: markdown
---
> Macro (aura-html)

### Abstract

This code snippet fetches the next unreleased version available for the current issue

### Logic

Access the available versions for the issue and filter the next unreleased version by the version date

### Snippet

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

### Placeholders

N/A

Examples

The output of this code is a String representing the name of a Version which you could use in a Groovy expression, for example, to set a Version picker field 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/461799437)
- [getAvailableOptions()](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461997007)
- [Version interface](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461538137)
- [**Groovy Documentation**](http://groovy.codehaus.org/User+Guide)

### Related articles

> Macro (contentbylabel)