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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Hide Issue Types from Jira Create Issue Screen

Hi All,

This question has been asked multiple times in the community, is there a definite way to hide certain Issue types from the create issue screen so that the users are not able to use them?

Does anyone have a working javascript which can be used in Jira 6.4 ?

 

Please assist.

7 answers

3 accepted

0 votes
Answer accepted
Joe Pitt Community Leader Jan 10, 2019

I haven't seen any solution to hide them. Just ones that will stop users from actually creating them. So the user will just be frustrated. The best solution is to put them in a different project that the said users don't have access to. Those with access to both can create a filter to include issues from both projects. 

0 votes
Answer accepted

Hello,

You can also implement this feature with the Power Scripts add-on:

https://marketplace.atlassian.com/apps/43318/power-scripts-jira-script-automation?hosting=cloud&tab=overview

You can find an example here how to restrict the issue type field:

https://confluence.cprime.io/display/TR/Forbidding+users+to+create+some+issue+types

You can also completely hide the field

0 votes
Answer accepted

The answer that you would have found on all the other postings is still true.  Your options are

  • Separate projects
  • Ugly kludges that annoy users by stopping them creating after they've entered data so they lose it all
  • Add-ons such as ScriptRunner that can amend it dynamically
4 votes
Payne Community Leader Jan 10, 2019

If you have the ScriptRunner add-on installed, this can be accomplished with Behaviours.

https://www.adaptavist.com/blog/restricting-issue-types-with-scriptrunner-for-jira/

Thanks @Nic Brough _Adaptavist_ @Alexey Matveev _cPrime_ @Joe Pitt @Payne
i find the Script Runner solution very intriguing. However, i forgot to mention that I am using Jira 6.4.13 and this version does not support SR 5.4.38.

Any alternatives?

Get an older version of Script Runner, one that is valid for 6.4 (the UPM under "find new add-ons" should automatically do this for you - it will install the latest compatible version of any add-on, and provide an "upload" link if you can't connect your Jira to the internet)

Like Netmarble likes this

After reading all the posts about how to approach hiding issue types from the drop down list, and experimenting with a few, I found the ScriptRunner Behaviour to be easiest to implement.  We simply added the below behaviour for ALL projects.  For us this is a set of issue types from an add-on that we no longer use.  This doesn't prevent users from importing these issue types but we deal with that separately.

import com.atlassian.jira.component.ComponentAccessor
import groovy.transform.BaseScriptimport static

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

// Get all issue types in the system.
def allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects

// Get the issue type form field
def issueTypeField = getFieldById(ISSUE_TYPE)

// A list to add all valid issues types to for setting into the form field.
def availableIssueTypes = []

// The code below works by excluding specific issue types. Although ALL other issue types will
// be added to the availableIssueTypes list, only those that are part of the project's
// issue type scheme will actually be listed.
allIssueTypes.each { issueType ->
if ( issueType.name != "IssueType1" &&
issueType.name != "IssueType2" &&
issueType.name != "IssueType3" )
{
availableIssueTypes.add( issueType )
}
}

// Add all the available issue types to the form drop down list.
issueTypeField.setFieldOptions(availableIssueTypes)

It works in a test environment. But it doesn't work live. Only jira versions are different. Could you help?

We are using Jira Data Center 8.5.0 and ScriptRunner 5.6.11.1-p5.

test environment : v8.2.1

work live: v7.10

I can't speak for whether or not the script I posted would work in older versions of Jira and/or ScriptRunner as I don't have those versions available to test.

It works for us, thanks @Jeffrey Gordon 

  1. Jira v8.5.4
  2. ScriptRunner 6.0.2-p5
import com.atlassian.jira.component.ComponentAccessor
import groovy.transform.BaseScript

// Get Issue Type Field as a constant value
import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE

// Get all issue types in the system.
def allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects

// Get the issue type form field
def issueTypeField = getFieldById(ISSUE_TYPE)

// A list to add all valid issues types to for setting into the form field.
def availableIssueTypes = []

// The code below works by excluding specific issue types. Although ALL other issue types will
// be added to the availableIssueTypes list, only those that are part of the project's
// issue type scheme will actually be listed.
allIssueTypes.each {
issueType ->
if ( issueType.name != "Issue_Type_To_Hide" && issueType.name != "Hide_Another_One" )
{
availableIssueTypes.add( issueType )
}
}

// Add all the available issue types to the form drop down list.
issueTypeField.setFieldOptions(availableIssueTypes)

Suggest an answer

Log in or Sign up to answer
TAGS

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