Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Behaviours Restricting Available Issue Types

Sema YILDIRIM April 7, 2020

I want to hide project-specific "issue type" data. The code I shared works on "Jira v8". "Jira v7" does not work. Could you help?

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager

import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE

def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects

def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issueTypeField = getFieldById(ISSUE_TYPE)

def remoteUsersRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name
def availableIssueTypes = []

availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["New Feature","Task","Test"] })

issueTypeField.setFieldOptions(availableIssueTypes)

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events