I use different workflows on the project. After one workflow is finished, I want the issue pass through other workflow. Right now, I can only manually change issue "Move issue" to change issue type. I want to add post functions to change issue type.
This is a very poor design, or at least data and process mapping into JIRA.
Your workflows should match your process. You don't have two processes here, you have one, so you should really have one workflow to match it. Also, generally, issue types are not something that should change as part of the process. Bugs don't suddenly become Epics just because you've got to a certain point in the process.
On the practical side, yes, you can change the issue type, but it's not going to be pretty. I would not try to do it as a post-function, as the issue type is structural, and you could potentially be changing the structure from inside it. Your idea means the issue will have two workflows. The post-function changing the issue type will be changing from one workflow to another while executing part of the current workflow. That is going to make a mess - you're effectively removing the current process partway through itself.
This should be done as a listener, which will pick up the last event and change the issue type after the transition is complete. Otherwise you'll have to deal with transient data changing during the process.
Second problem is that your code is going to have to replicate what "move" does - checking all the data to ensure it is valid in the new configuration for the target issue type.
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG