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

2

Restrict Creation of Certain Issue Types to Members of a Project Role

Overview

Add this script to a ScriptRunner Simple Scripted Validator on the Create step of a workflow to restrict the creation of certain types of issues to members of a specified project role.

Example

I am a Project Manager. In my development team, I have two staff members who are in charge of Bug issue types. I want to make sure that any bug issues created can only be assigned to one of these two developers. To do this, I create a project role with the two developers and use this script to restrict the assignee.

Good to Know

  • The project role must exist and contain the users who we want the transition to be validated.
  • The issue type must exist.
  • You can configure the step in the workflow where you want the validator to be executed.

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.security.roles.ProjectRoleManager // the name of the project role def roleName = 'Project Manager Role' // the name of the issue type def issueType = 'Epic' def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager) def role = projectRoleManager.getProjectRole(roleName) issue.issueType.name == issueType && projectRoleManager.isUserInProjectRole(issue.reporter, role, issue.projectObject)
Discovered an issue? Report it here

Suggested for you

Appears in these Collections