Behaviour plugin - set version field



I want to set a default value for the Fix Version/s field of an issue (Story) created from an Epic. The default value should be the current Fix Version/s of the Epic issue.

Here a code extract:

// Get Epic linked to this issue
FormField epicField = getFieldByName("Epic Link")
def epicKey = epicField.getFormValue().replaceAll("key:","")
def epic = issueManager.getIssueObject(epicKey)
def fixVersions = epic.getFixVersions()
if (fixVersions.size() > 0) {
    FormField fldFixVersion = getFieldById("fixVersions")

Something does not work (setFormValue() ???). In the log I find

http-bio-8080-exec-4 DEBUG [onresolve.jira.groovy.BehaviourManagerImpl] Returning map: [fixVersions:[setValue:[V1], fieldType:com.atlassian.jira.issue.fields.FixVersionsSystemField, displayName:Fix Version/s]]

, "V1" is the name of the version in the Fix Version/s field of the Epic. The code in the log file seems to be correct. Why do I not see the value ("V1") in the Fix Version/s field of the issue I create ???


JIRA 6.1.6

Behaviour plugin 0.5.10

2 answers

1 accepted

0 vote

getFixVersions() returns you a list of Version objects. But when you set the form value you need to pass it a list of version IDs.

So try replacing with:


This will only work as you expect if the issue being created is in the same project as its epic. If not those IDs won't be valid for fix versions in the other project. 

Hi Jamie,

This works indeed. Thanks for your quick and valuable help (as always smile)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

840 views 2 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you