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

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
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,696 views 3 11
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