Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Hide common issue types from across multiple Jira projects.

jira_admin_cu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 1, 2025

Hi Team,

We have a requirement to remove three specific issue types—"Epic," "Enabler," and "Feature"—from hundreds of Jira projects. However, we want to keep the existing tickets under these issue types for all projects. Since these 100+ Jira projects have various other issue types, I cannot simply include them all in the user roles. Therefore, I want to exclude these three issue types. I tried using the following ScriptRunner behavior, but it still shows all the issue types available in the project instead of excluding these three. Is there something wrong with my script?

 

scriptrunner script.png

I am in a "User" role, but its displaying "Epic," "Enabler," and "Feature"

issue types.png

import com.atlassian.jira.component.ComponentAccessor

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

import com.onresolve.jira.groovy.user.FieldBehaviours

import groovy.transform.BaseScript

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

@BaseScript FieldBehaviours fieldBehaviours

def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)

def constantsManager = ComponentAccessor.constantsManager

def allIssueTypes = constantsManager.allIssueTypeObjects

def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser

def issueTypeField = getFieldById(ISSUE_TYPE)

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

def availableIssueTypes = []

if ("Issue Type Visibility Controller" in remoteUsersRoles) {

    availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Epic", "Enabler", "Feature"] })

}

if ("Users" in remoteUsersRoles) {

    def excludedTypes = ["Epic", "Enabler", "Feature"]

    availableIssueTypes.addAll(allIssueTypes.findAll { !(it.name in excludedTypes) })

}



issueTypeField.setFieldOptions(availableIssueTypes)

1 answer

0 votes
Matteo Vecchiato
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 1, 2025

Suggest an answer

Log in or Sign up to answer