Hi,
I'm creating a behaviour in scriptrunner to copy specific fields of the current issue to a new task in another project.
I'm able to do it on all the fields I require except "Affects Versions" which is not copying anything.
Here is my script :
import com.atlassian.jira.component.ComponentAccessor
def issueManager = ComponentAccessor.getIssueManager()
if (getBehaviourContextId() == "create-myproject-linked-task") {
getFieldById("project-field").setReadOnly(true)
getFieldById("issuetype-field").setReadOnly(true)
def contextIssue = issueManager.getIssueObject(getContextIssueId())
getFieldById("summary").setFormValue(" support request for ${contextIssue.key}").setReadOnly(true)
getFieldById("issuelinks-linktype").setFormValue("relates to").setReadOnly(true)
getFieldById("issuelinks-issues").setFormValue(contextIssue.key).setReadOnly(true)
getFieldById("labels").setFormValue("Customer,Support").setReadOnly(true)
getFieldById("versions").setFormValue(contextIssue.key).setReadOnly(false)
getFieldById("description").setFormValue("Only for time tracking for L4 support. Any functional or technical analysis and comments should be tracked in related project.")
}
As you can see the faulty line is :
getFieldById("versions").setFormValue(contextIssue.key).setReadOnly(false)I searched a solution on internet for hours but did not find anything. I guess it has something to do with the fact that it returns a list and not a string but I can't find the proper way to make it work.
Does anybody have the solution for this?
thanks