I have a transition screen with a custom field (with type, User Picker (single user), I called it "Internal User"). I also have a post function for this transition that creates a sub-task. I would like the post function to set the assignee of the sub-task to the custom field value of "Internal User".
Here is what I have so far:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customfieldname = customFieldManager.getCustomFieldObjectByName("Internal User")
def valueofcustomfield = issue.getCustomFieldValue(customfieldname) as ApplicationUser
if(valueofcustomfield){
issue.setAssigneeId(valueofcustomfield.username.toString())
}
The new sub-task is being created, but it is unassigned every time.
I am using script runner version 5.4.12.
I am using JIRA version 7.10.2.