Need to copy the value from a version picker field to Fix versions in post function via script listn

C M JENIN February 20, 2018

Hi Folks,

 

I need to copy the value from a custom field in Jira to Fix Version field in a workflow postfunction in Jira via Script Runner plugin.

 

Need help with the groovy script to do the same.

 

Thanks and Regards,

Jenin C M

1 answer

2 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2018

Something like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.event.type.EventDispatchOption




def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def csVersionPicker = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("version_picker")
log.error(issue.getCustomFieldValue(csVersionPicker))
List<Version> versionList = (List<Version>) issue.getCustomFieldValue(csVersionPicker)
issue.setFixVersions(versionList)
ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)

Suggest an answer

Log in or Sign up to answer