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")
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.