---
title: "Set a version field to versions of all its linked issues"
canonical: "https://support.appfire.com/space/JMWE/461964069/Set%20a%20version%20field%20to%20versions%20of%20all%20its%20linked%20issues"
format: markdown
---
> Macro (aura-html)

### Abstract

This code snippet sets a version field to versions of all its linked issues

### Logic

Access the linked issues of the current issue, fetch the versions of each linked issue and return them.

### Snippet

```javascript
Set versions = []
issue.getLinkedIssues().each(){
  versions += it.get("<Name of the version field>")
}
return versions
```

> ⚠️ Note that the above snippet fetches all linked issues for the current issue, except the Parent/Sub-task, Epic/Story, Initiative/Epic and Remote links

### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Version field name`> | Name of the field of type Versions | `Fix Version/s` |

### Examples

The output of this snippet is a [Collection](http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html)`<`[Version](https://appfire.atlassian.net/wiki/display/JMWE/Version+interface)`>` which you can use in a Groovy expression, for example, to set the Affects Version/s of the issue to the Affects Version/s of all its linked issues in

- one of the Set field value post-functions
- the <span style="color: #333333">Create issue post-function under the Set fields of new issue section</span>

### References

- [Variables used in a Groovy expression](https://appfire.atlassian.net/wiki/display/JMWE/Variables+used+in+a+groovy+expression)
- [getLinkedIssues()](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461537734)
- [**Groovy Documentation**](http://groovy.codehaus.org/User+Guide)

### Related articles

> Macro (contentbylabel)

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