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
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
// get issue by key for example
MutableIssue issue = ComponentAccessor.getIssueManager().getIssueObject('ABC-123')
def newIssueType = ComponentAccessor.issueTypeSchemeManager.getIssueTypesForProject(issue.getProjectObject()).find{it.getId() == "3"}
issue.setIssueTypeObject(newIssueType)
// update issue for saving changes
ComponentAccessor.issueManager.updateIssue(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), issue, EventDispatchOption.DO_NOT_DISPATCH, false)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.