Automate change of default status for an issue based on issue type

Tony
Contributor
September 19, 2011

Anyone have any suggestions on how to change the status of an issue from its default status to another status based on the value of the issue type?

2 answers

1 accepted

3 votes
Answer accepted
Nic Brough -Adaptavist-
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.
September 19, 2011

I'm not sure what a "default status" means, but I'm assuming it's the status an issue is created in?

The most simple approach is to create a new workflow which starts with a different status, and associate it with the issue type.

For example, if you have "bug" and "improvement", then you create a bug-workflow, where the "create issue" transition lands on (say) "new", and for the improvement-workflow, the create should land on (say) "open". You then use "workflow schemes" to tell your project which workflow to use for which issue type.

Tony
Contributor
September 20, 2011

Btw -- your initial assumption is correct -- the default status is the status the issue is created in, in this case 'New'. It is defined in the emh.properties file in the jira instance.

Nic Brough -Adaptavist-
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.
September 20, 2011

The emh.properties file is not where the status is defined, the status is a function of the workflow. From (dubious) memory, the file you mention is just where Jira creates the default workflow from when you install it.

I'm not sure how I can explain configuring workflows better than the docs - http://confluence.atlassian.com/display/JIRA/Configuring+Workflow

Tony
Contributor
September 20, 2011

Thanks Nic. I think you are on to something here. Let me elaborate since you had a good question at the beginning:

Senario: All new issues are created with a status of 'New' with the exception of one issue type, which after being created must be given a different status other than new.

So knowing that, do you think just having a separate workflow for that issue type would work? Could you clarify how this would be done?

Cheers!

Tony
Contributor
September 20, 2011

It appears that when you create an issue the workflow manager forces you to go to "Open". Is this your understanding? Also, if it is, is there some way to move it to another status unconditionally within the workflow?

Cheers!

Nic Brough -Adaptavist-
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.
September 20, 2011

Ah, no, again, the jump to "open" is a default, not an absolute. It's there because creating a workflow without a Create -> Open hook is a nightmare to code for - it's far easier to create it as a default. What you need to do is

  1. Add the new step you want "Create" to land in
  2. Edit the create transition
  3. Change it's end point to the new step
  4. Kill off the "open" step if you don't need it

For moving to another status unconditionally, no, not off-the-shelf. The point of a workflow is a human runs it. But, as there are cases where you could want to end up in more than one status, there are workarounds - listeners can do it, but also the script runner, as Jamie has already said.

0 votes
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.
September 20, 2011

The problem with Nic's suggestion is that you end up with a multiple maintenance problem with all these only-slightly-different workflows.

You could try the fast-track transition built-in script from the script runner plugin. You would create one workflow only, where the starting status is New. Then you use the above to automatically transition to say, Open if the issuetype is whatever. You need to have an action from New to Open, but you can prevent it being shown with a condition.

Nic Brough -Adaptavist-
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.
September 20, 2011

My instinct is always to explain how to do something without plugins first. The script runner, or finding/writing a listener are also options, although you will end up with a single workflow, you've just moved the complexity into the script/listener - someone looking at your workflow won't instantly see how the second status arrives.

Also, a question, if you do it with the script runner, won't you end up wit a two step history? (Not that this is a problem in the slightest, just curious, because I've never tried it)

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.
September 20, 2011

Yes, I think your answer was spot on, it's important to know how to do things without plugins first. I was only quibbling with the actual method you suggest, not your answer.

And yes, the automatic action is recorded in the history.

Tony
Contributor
September 21, 2011

Hello Nic,

I don't see how I can '2. Edit the Create Transition' from your suggestion above (which I like, by the way). The Workflow Designer will not allow me to 'disconnect' the step from 'Create' to 'Open'. Any explanation as to why this may be so?

Cheers!

Suggest an answer

Log in or Sign up to answer