Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Automatically transit cloned in ScriptRunner post action

Jira SW v7.13.1 (Server)

ScriptRunner Version: 6.2.1

In transition of some issue I'm cloning the issue in post-function ("Clones an issue, and links").

I need to move cloned issue to another status (different from Opened) during cloning.

I do it using "Additional issue action" and script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.workflow.WorkflowTransitionUtil
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl
import com.atlassian.jira.issue.Issue

WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class);
workflowTransitionUtil.setIssue(issue);

// 21 - it is number of transition action
workflowTransitionUtil.setAction(21);
workflowTransitionUtil.validate();
workflowTransitionUtil.progress();
 
 I receive the following error during running this script:

org.ofbiz.core.entity.GenericTransactionException: Commit failed, rollback previously requested by nested transaction.
It seems that you have tried to perform an illegal workflow operation.
If you think this message is wrong, please contact your Jira administrators.     

What is incorrect?        

1 answer

Suggest an answer

Log in or Sign up to answer

I think you might have missed out on setting the user that would execute this transition. You might be missing the following method :

workflowTransitionUtil.setUserkey

Here are the details of the Jira API setUserKey 

The workflow script below might help to point you in the right direction if you are unsure
https://community.atlassian.com/t5/Jira-questions/Script-Runner-Transition-parent-issue-based-on-subtask-status/qaq-p/1179487

Hope this helps!

TAGS
AUG Leaders

Atlassian Community Events