Forbidding users to create some issue types
Required apps
Power Scripts™ for Jira 2.5.2+ (server)
Level: BASIC
Problem
We want to hide some issue types from certain users during the issues creation.
For example, we want to remove issue types `New Feature` and `Improvement` from the list of the available Issue Type during the issue creation, if the current logged in user is not the project leader.
Solution
We will use the lfRestrictSelectOptions to hide some issue types for the project leader. All you have to do is to create the following script and associate it with the main Live Fields configuration on your project, as described here. Note that we do not look for the "Create Issue" screen, since we do not want the user to create an issue and then change its type using Edit. This way, the issue types will be hidden regardless of the screen (create/edit/transition).
string project = "TP"; //the project key string pm = projectPM(project); string[] forbiddenTypes = {"New Feature", "Improvement"}; //the array of the issue types to restrict if(pm != currentUser()) { lfRestrictSelectOptions("issueType", forbiddenTypes); }
Pay attention to pass in the first parameter correctly for the lfRestrictSelectOptions routine, using quotes ("issueType"), in order to pass in the actual field label name for the current screen.
Otherwise, SIL™ Interpreter will attempt to get the issueType from the current issue and will fail on the "Create Issue" screen since the issue is not yet created.
The above SIL™ script makes use of the lfRestrictSelectOptions routine offered by Power Scripts™ for Jira's Live Fields feature.
See also
- Restricting resolutions based on issue type
- Forbidding specific priorities for certain projects
- Hide fields from users not in a project role
- Limit Number of Characters in Text Field
- Lock an issue - a better variant (Live Fields)
- Locking Issues
- Making an issue read-only
- Require an issue to have attachments
- Require User to Log Work Before Transitioning Issue
- Restrict issue type availability by user
- Restrict workflow based on status of dependencies
- Validator for component lead