Set Assignee of Sub-Task

Jh
Contributor
July 24, 2020

I am trying to alter a sub-tasks auto assignee from a post function script. The previous assignee no longer works here so I am just changing the username/value of it to the new one, just changing "agent username" in issue.setAssigneeId("agent username"), but when I go to test it out, the Assignee value is a fixed field instead of the assignee it is intended to be. When I go to the drop-down to try and pick the Assignee from the list, it only lists the field value I input in my script instead and not show the agent.

Below is my script, what is wrong?

//issue.assigneeId = "user1"

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Additional Assignees'}

def userManager = ComponentAccessor.getUserManager()

issue.setAssigneeId("agent username")
issue.setCustomFieldValue(cf, [userManager.getUserByName("user1")])

issue.setDescription("--Remove user's name from telephone description\n--Change telephone owner to anonymous\n--Delete voicemail account\n--Delete extension from AD account")

 

1 answer

0 votes
Krzysztof Daukszewicz [CoreSoft Labs]
Atlassian Partner
July 24, 2020

Just saying, if you want to avoid scripting and make your workflows more automatic, we have an App for that - it's called Workflow PowerBox and it does a lot of magic.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.7.1
TAGS
AUG Leaders

Atlassian Community Events