I hava find Ref: https://community.atlassian.com/t5/Answers-Developer-Questions/Changing-the-issue-type-with-groovy/qaq-p/543998
code :
import com.atlassian.jira.component.ComponentAccessor
def newIssueType = ComponentAccessor.issueTypeSchemeManager.getIssueTypesForProject(issue.projectObject).find{it.name=="support"}
if (newIssueType) issue.setIssueTypeObject(newIssueType)
The issue type does change, but the workflow seems to only be partially migrated. The View Workflow button on the issue does show the new workflow, but no workflow buttons are available.
I suspect your issue types are configured differently.
The line of code you have found there only works for issue types that are using exactly the same configurations. If you want to change between issue types properly, you need to code for all the migration between configurations as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.