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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,732
Community Members
 
Community Events
184
Community Groups

"Error occurred while storing issue" related to workflowTransitionUtil.setAction(id)

Edited

Goal: If any sub-task of a parent issue transitions to DENIED, the parent issue also auto-transitions to DENIED. They are using different workflows, however both workflows have a transition called "Deny request" that goes to status "DENIED".  

I've added the following script (source) as a post function on my sub-task workflow's "Deny request" transition. The script in its copy-pasted state (meaning it uses 11 as the ID for setAction()) successfully transitions the parent issue to APPROVED when I execute the sub-task's "Deny request" transition. I'd like it to do essentially the same thing but instead of APPROVED, I'd like it to transition to DENIED. 

import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.comments.CommentManager;
import com.opensymphony.workflow.WorkflowContext;
import org.apache.log4j.Category;
import com.atlassian.jira.config.SubTaskManager;
import com.atlassian.jira.workflow.WorkflowTransitionUtil;
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl;
import com.atlassian.jira.util.JiraUtils;
import com.atlassian.jira.issue.MutableIssue;
log = Category.getInstance("com.onresolve.jira.groovy.AutoCloseChildIssues");
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller();
WorkflowTransitionUtil workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class);
MutableIssue parent = issue.getParentObject() as MutableIssue;
workflowTransitionUtil.setIssue(parent);
workflowTransitionUtil.setUserkey(currentUser);
workflowTransitionUtil.setAction(11); // when I change this to workflowTransitionUtil.setAction(21); I get the error 
workflowTransitionUtil.validate();
workflowTransitionUtil.progress();

These two transitions, Approve request (id = 11) and Deny request (id = 21), exist in both the parent issue and sub-task workflows. 

transitions.png

When I change setAction(11) to setAction(21), and try to execute "Deny request", I get the following error.

error.png

Is it a coincidence that setAction(11) happens to share an id with my Approve request transition? Or is that saying, "execute transition with id 11"? I'm confused why 11 works but not 21, when they are both transitions in my workflow.

It seems like replacing 11 with 21 should cause it to execute the parent's "Deny request" transition, since it successfully does the "Approve request" transition using 11. 

Thanks in advance.

2 answers

Очень информативно!!!

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 09, 2017

Hi Steve, for questions like this one my suggestion would be to post it at community.developer.atlassian.com. That's where our developer community hangs out and you'll be more likely to get a good answer there :)

Best regards,

Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events