Forums

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

ScriptRunner Behaviours: Hidden issue types can still be selected by typing (Ex : Epic)

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 Champions.
January 26, 2026
We are using ScriptRunner Behaviours in Jira Data Center to hide the Epic issue type from the Issue Type dropdown for certain projects. While Epic is hidden from the list, users can still create Epics by manually typing “Epic” into the Issue Type field. Based on the documentation, it appears this is a limitation of Behaviours, as they control only the dropdown, not the type‑ahead search. Can someone confirm whether this behavior is expected and whether there is a supported way to prevent hidden issue types from appearing when typing and how to resolve that?

I used the script below as a scriptrunner behaviour script in an initializer, and I'm using it for 60+ Jira projects.

Please find the attached screenshots for your reference.

 

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 allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser

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

if ("Jira Security Role" in remoteUsersRoles) {
    availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Epic","Enabler","Feature"] })
}

if ("Users" in remoteUsersRoles) {
    availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Bug", "Defect", "Dependency", "Enhancement", "Spike", "Story", "Sub-task", "Support Request", "Task", "Customer Incident", "Troubleshoot Request", "Improvement""Service Request","Tech Debt","Support"] })
}


issueTypeField.setFieldOptions(availableIssueTypes)
epic1.jpgepic2.jpg

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events