How to copy fix versions field when creating new issue using behaviors/script fragments

Lara Arthur April 26, 2019

Hi there. I set up a "Create Defect" button on my ticket screen. 

I've been able to create a pop up screen with all fields I want copied over from the main ticket except for fix versions. I have no idea what I'm missing here...since I've been able to get the field on my screen as read only, it just doesn't copy from the original ticket.

What am I missing here?

Original ticket...linking with defects

image.png

Popup screen:  no fix version carry over

image.png

Script in Behaviour:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.version.Version

def issueManager = ComponentAccessor.getIssueManager()
def version = ComponentAccessor.getVersionManager()

if (getBehaviourContextId() == "link-create-defect") {
getFieldById("project-field").setReadOnly(true)
getFieldById("issuetype-field").setReadOnly(true)
getFieldById("fixVersions-field").setReadOnly(true)

def contextIssue = issueManager.getIssueObject(getContextIssueId())
getFieldById("issuelinks-linktype").setFormValue("blocks validation of Baseline").setReadOnly(true)
getFieldById("issuelinks-issues").setFormValue(contextIssue.key).setReadOnly(true)
getFieldById("fixVersions").setFormValue(contextIssue.key).setReadOnly(true)

image.png

0 answers

Suggest an answer

Log in or Sign up to answer