---
title: "Find the earliest unreleased version scheduled after a certain date"
canonical: "https://support.appfire.com/space/JMWEC/466289442/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 find the earliest unreleased version scheduled after a certain date</span>

### Snippet

```javascript
{% set vers = {} %}
{% for v in issue | projectInfo | field("versions") %}
  {% if not v.released and v.releaseDate >= <Specific date> and (vers.releaseDate == null or vers.releaseDate > v.releaseDate) %}
    {% set vers = v %}
  {% endif %}
{% endfor %}
{{vers.name}}
```

### Placeholders

| Placeholder | Description | Example |
| --- | --- | --- |
| <sup><Specific date></sup> | Access the field of type Date | `issue.fields.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 template, for example, to set the Fix Version/s <span style="color: #172b4d">of an issue to the earliest unreleased version scheduled after the Due date</span> in:

- one of the Set Field Value post-functions
- one of the Transition issue post-functions on the transition screen, if any
- the Create issue post-function under Set fields of new issue section

### References

- [Using Nunjucks Templates](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465503811)
- [projectInfo filter](/wiki/spaces/MWECS/pages/78482118)
- [field filter](/wiki/spaces/MWECS/pages/78482118)

### Related articles

> Macro (contentbylabel)