How to disallow certain issue types in a transition screen?

Marcel_R__Ackermann
Contributor
February 5, 2012

Hi.

In our workflow it is necessary that we do allow a certain generic "untyped" issue type when an issue is created (since at this point we may not have enough information on the nature of the issue). However, after a certain step at the latest, the issue type has to be specified as one one of the regular "typed" issue types. To this end, one has to choose a type from an issue type picker, but one should not be allowed to proceed if the "untyped" type has been selected.

Is there a way to achieve this using validators an (maybe) standard third party plugins only (i.e., without tweaking the source code)?

I already tried to build such a transition using the Universal Validator from the JIRA Workflow Enhancer which seemed perfect at first. However, the plugin seems to be broken in its current state and I did not find a way to make an expression using {Issue type} work.

Many thanks in advance. Any help is appreciated.

1 answer

1 accepted

1 vote
Answer accepted
Marcel_R__Ackermann
Contributor
February 14, 2012

I found a solution to this problem using the Behaviours Plugin (which is such a great plugin that i cannot praise it high enough.) In fact, it is quite easy once you know what you have to do.

To forbid a particular Issue Type on a transition screen with editable issue type picker you have to:

  1. Install the Behaviours Plugin
  2. Choose Administration -> Plugin -> Behaviours
  3. Add a new behaviour
  4. In the behaviour's Fields screen, add the Issue Type field
  5. Add a Validation Script ("Add serverside script") like the following to 'Field: Issue Type' (of course, you should adjust the if-condition and error message according to you needs)
    FormField issueTypeField = getFieldById("issuetype")
    
    if ( issueTypeField.getValue() == "9" ) {
        issueTypeField.setError( "Choose another issue type." )
    } else {
        issueTypeField.clearError()
    } 
  6. Optionally, set the Guide Workflow to your workflow and add Conditions to pick the transition for which the behaviour should take effect
  7. Finally, go to the behaviour's Add Mapping screen and associate the behaviour with your project
  8. Test and have fun

Works great for me.

JamieA
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.
February 14, 2012

Great description of the problem and solution ;-)

Marcel_R__Ackermann
Contributor
February 14, 2012

And I have to thank you for the great plugin. :) I cannot believe how much time i already wasted with this problem before i found this rather clean solution.

Suggest an answer

Log in or Sign up to answer