Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Service Desk: Changing Issue Type via postfunction

Florian January 16, 2019

Hello,

i want to change the issue type via a postfunction during a transition.

It seems to be possible with the JMWE postfunction "Set field value". In the configuration of the postfunction i can set the the new value to the new issue type.

While testing, the postfunction is working correctly. The Issue Type is changing from "Incident" to "Task". 

Unfortunatly, all the Transitions in the workflow seems to be crashed. There are no Transition-Buttons available in the Issue. Obviously there is something going wrong while transforming the workflow.

Does anybody has any ideas? 

Thank you for your help

4 answers

3 accepted

0 votes
Answer accepted
Ravi Varma
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.
January 16, 2019

Hi @Florian,

You should give a second thought, if this is your use case.

JIRA allows defining configurations at issue type level, which makes JIRA so flexible and scalable.

Reason for abnormal behaviour - As you have changed the issue type, the workflow associated with the new issue type would come into effect and hence the new transitions and statuses pertaining to the new workflow would be shown. In fact, if there had been a broken validation, JIRA would not have allowed you to change the issue type. 

  • My recommendation would be to never change the issue type, unless you are aware of the consequences.
  • You should be supplementing/realizing your use case by using a custom field.
  • If it is imperative to change the issue type, then you have to ensure that the configurations for both issue types are same.

Hope this addresses your concern.

If you feel that this is useful then please accept my answer, which would motivate us take up more community questions.

Regards,

Ravi Varma

0 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.
January 16, 2019

Issue type is not really a simple  "field".  It's a structural property of an issue, off which hangs a load of configuration data.

My guess is that you have different workflows for Incident and Task - these hang off the issue type.  So if you just change the issue type without doing all the workflow migration, they will fail, badly.

You should not use this post-function to change the issue type, unless ALL the configuration for the source and target issue types are shared (not even identical, they have to be shared)

0 votes
Answer accepted
David Fischer
Community Champion
January 16, 2019

Hi Florian,

unfortunately, setting the Issue Type field only works if both source and destination issue types share the same workflow. Otherwise, Jira gets confused. 

What you'd need is a "Move Issue" post-function but it's not that simple, as there are many steps involved in moving an issue (see what happens when you use the "Move issue" operation in the UI). And unfortunately there is no "Issue Move" Manager or Service in the Jira API that you could easily use in a Groovy post-function either.

You can Google "jira scriptrunner move issue" for code examples (ScriptRunner code snippets will usually work as is in JMWE, although they can be simplified using JMWE's simplified API) but it looks like none works satisfactorily.

0 votes
Florian January 16, 2019

ok, thank you guys for your immediate support. All your answers were really helpful, even though not what i hoped for :)

@Nic Brough -Adaptavist- you mentioned that the workflows of both issue types not only have to be same, rather they have to share one workflow. 

I just copied the workflow of "Incident" and allocate it to the Issue Type "Task". Obviously it is working. All the transitions are usable.

What are the "consequences" you mentioned above?

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.
January 16, 2019

True, this will work.  A direct copy should be ok.  But workflows are often not the same even if they look the same, and more importantly, often drift - you can only be 100% sure that they are compatible if you know you are the admin who copied it and the only one who might edit it (and won't because you know of this issue), or the workflow is shared.

Like # people like this
Florian January 17, 2019

ok, thank you Nic. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events