You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.atlassian.jira.util.JiraUtils
import com.atlassian.jira.workflow.WorkflowTransitionUtil
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl
MutableIssue issue1= issue;
WorkflowTransitionUtil workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class );
workflowTransitionUtil.setIssue(issue1);
workflowTransitionUtil.setAction(321);
workflowTransitionUtil.validate();
workflowTransitionUtil.progress();
But I t doesn't work .
In the jira Log I'm viewing the following message.
Hi Sergio,
So for this you will need to write a script that will transit the cloned issue after it's creation.
So in the additional issue actions field you can have something like
def user = ComponentAccessor.userManager.getUserByKey("admin")
doAfterCreate = {
// 21 is the id of the step you want the issue to move
transitIssue(issue, 21, user)
}
def transitIssue(Issue issue, int actionId, ApplicationUser cwdUser) {
def issueService = ComponentAccessor.getIssueService()
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.setComment("This is a comment")
issueInputParameters.setSkipScreenCheck(true)
def transitionOptions= new TransitionOptions.Builder()
.skipConditions()
.skipPermissions()
.skipValidators()
.build()
def transitionValidationResult =
issueService.validateTransition(cwdUser, issue.id, actionId, issueInputParameters, transitionOptions)
if (transitionValidationResult.isValid()) {
return issueService.transition(cwdUser, transitionValidationResult).getIssue()
}
log.error "Transition of issue ${issue.key} failed. " + transitionValidationResult.errorCollection
}
Hope that helps, please ping me if you have any further questions
Regards, Thanos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.