Hi,
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") fldFixVersion.setFormValue(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
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:
fldFixVersion.setFormValue(fixVersions*.id)
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 )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.