Hi,
I am using script runner to create a new issue, need to set its type to "mytype"...but I am stuck.
Any help?
Thank you!
Hi Adolfo:
I found a link for you that helped me
https://answers.atlassian.com/questions/133053/changing-the-issue-type-with-groovy
I need to do this too. The link above does not work for me. If use this code, it IS getting the newIssueType, but is not able to change the issue type:
import
com.atlassian.jira.component.ComponentAccessor
def newIssueType = ComponentAccessor.issueTypeSchemeManager.getIssueTypesForProject(issue.projectObject).find{it.name=="Information Only Change"} if (newIssueType) issue.setIssueObject(newIssueType)
yes, I do it. but .... 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.
You have to use MutableIssue class, not Issue.Issue for getting info only, MutableIssue for both: getting and changing your issue.
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.event.type.EventDispatchOptionimport com.atlassian.jira.issue.MutableIssue// get issue by key for exampleMutableIssue issue = ComponentAccessor.getIssueManager().getIssueObject('ABC-123')def newIssueType = ComponentAccessor.issueTypeSchemeManager.getIssueTypesForProject(issue.getProjectObject()).find{it.getId() == "3"}issue.setIssueTypeObject(newIssueType)// update issue for saving changesComponentAccessor.issueManager.updateIssue(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), issue, EventDispatchOption.DO_NOT_DISPATCH, false)
It looks like you're new here. Sign in or register to get started.