I'm trying to capture the current assigned user on an issue to custom user picker field in a scri

RICHARD KING July 18, 2017

I'm trying to capture the current assigned user on an issue into a custom user picker field in a script. 

I'm just using the script console at the moment to attempt this but the value in the custom field does not persist? If I can get this to work I want to use it in a post function to run when the issue transitions from one particular workflow step to the next. The console logs indicate I'm getting the user object but the setCustomFieldValue does not seem to work?

---------------------------

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.UserUtils

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issue = ComponentAccessor.getIssueManager().getIssueObject("PR1-123")
def lastDeveloper = customFieldManager.getCustomFieldObjectByName("Last Developer")

def currentAss = UserUtils.getUserManager().getUserByKey(issue.assigneeId)

log.warn(currentAss )

issue.setCustomFieldValue(lastDeveloper, currentAss)

 

0 answers

Suggest an answer

Log in or Sign up to answer