You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!

2

Create Multiple Assignees in an Issue

Overview

Associate multiple assignees with an issue via custom fields, so each user corresponds to a specific issue status.

Example

Several users are responsible for an specific status of an issue. Using this script I can specify which user corresponds to each stage.

Good to Know

  • Create custom fields to store the assignable users.
  • Associate this script with the All Issue Events event listener.
  • You can use this script in a post-function using the implicit issue variable instead of event.issue.

Requirements

  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
    
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.user.ApplicationUser def issue = event.issue as MutableIssue final customFieldManager = ComponentAccessor.customFieldManager final statusName = 'Testing' def roleName = (issue.status.name == statusName) ? 'Tester' : 'Engineer' def assignee = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjects(issue).find { it.name == roleName }) as ApplicationUser if (!assignee) { return } if (issue.assignee && issue.assignee.username == assignee.username) { return } def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser issue.setAssignee(assignee) ComponentAccessor.issueManager.updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)
Discovered an issue? Report it here

Suggested for you