Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Need to hide issue types from issue type drop down

I have two sub task types - Subtask and Defect subtask . The Defect subtask is  for Bug issue  and Sub-task is  for all other issue type. When ever I click On the Create subtask screen , both  Sub task and Defect  issue type get populated from the Issue type drop down. I  would like to  hide the Sub task and make it Defect when  I  create a defect subtask under the Bug issue type.


 create bug issue type-> click on the create a sub task-> Create sub task screen is displayed. In the drop down on the Create subtask screen I see sub task and defect sub task both. I have tried to hide the sub task .But I am not able to. If I make defect subtask read only using the behavior plugin, it is affecting all other Create subtask screen for other issue types(EPIC , User story , task). How do I handle this in Create sub task screen.

Is there a way to create new create subtask screen for Defect subtask (issue type)


1 answer

1 vote


Welcome to the Atlassian Community.

I don't think you need to build new screens etc.

You can use behaviour to manipulate the list of issue types offered  in the drop down.

The trick is that you need to get information about the parent issue (to know which issue type to show or hide).

And you'll want to make sure that the behaviour only fires when a sub-task is being created (not the parent issues).

Try something like this (in the initializer of a behaviour for your project either mapped to all issue types or just the 2 sub-tasks)

import com.atlassian.jira.component.ComponentAccessor

if(issueContext.issueType.isSubTask()){ //this may not be needed if the behaviour mapping is only for the sub-tasks
def issueTypeField = getFieldById('issuetype')
def parentIssueIdFld = getFieldById('parentIssueId')
def parentIssue = ComponentAccessor.issueManager.getIssueObject(parentIssueIdFld.value as Long)
def allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects

def subtaskName

if( == 'Bug'){
subtaskName = 'Defect'
} else {
subtaskName = 'Sub-task'
issueTypeField.setFieldOptions(allIssueTypes.findAll{ == subtaskName})
issueTypeField.setFormValue(allIssueTypes.find{ == subtaskName}.id)

Thank you this code actually worked. It tested it further and added a new subtask by name ' Test Sub-task' , I went ahead and created a create subtask under bug issue type and on the create sub task screen , under the Issue type drop down , I was able to select  the Newly created 'Test Sub-task' from the Issue type drop down. I believe any time a new subtask is added , The new subtask will be displayed under the issue type drop down. How do I handle this issue in future any time a new subtask type is added. 

I would like Bug issue type(Parent issue) to have only  'Defect' Sub task associated with it all the time even if a new Subtask like ' Test Sub- task ' created.

I have hidden behavior to  'Sub-task' subtask in the Script runner  UI Hide element behavior.

If you want defect for Bug and all-but defect for non-bug, then the flow of the script could look a little like this:

def allowedSubtasks = []
if( == 'Bug'){
allowedSubtasks = allIssueTypes.findAll{ == 'Defect'}
//since there is only 1 available subtaks, might as well select it
} else {
allowedSubtasks = allIssueTypes.findAll{ != 'Defect'}

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

370 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you