Changing IssueType within Workflow Validator Class causes Workflow Post Functions to stop working

Hi!

JIRA 7.3.6 Standalone
Atlassian Plugin SDK 6.2.2

We have created an Atlassian Plugin which changes the IssueType of another linked Issue within a Workflow Validator Class:

import com.opensymphony.workflow.Validator;  

// validate
public void validate(Map transientVars, Map args, PropertySet ps) throws InvalidInputException {  
final Issue issue = (Issue)transientVars.get("issue");    
…  
IssueManager im = ComponentAccessor.getIssueManager();  
MutableIssue linkedIssue = im.getIssueObject(issue.getId());   linkedIssue.setIssueType(bug);   im.updateIssue(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), linkedIssue, EventDispatchOption.DO_NOT_DISPATCH, false); 
...
}  

Changing the IssueType of the linked Issue works fine and it causes the linked Issue to have another Workflow, which is correct.
 
Though everything seemed to work fine, we realized, that after changing the IssueType, no more Workflow Post-Functions are called anymore when State Transitions occur for the linked Issue.

Any Ideas on how to get the Workflow Post Functions working in this scenario would be greatly appreciated!

Thanx in advance,
Hans

2 answers

This widget could not be displayed.

NO!  Never do this, it's an utter disaster no matter what you do.

A validator should make NO changes to any data.  It should return either "True" or "False" and do nothing else.

Hi Nic!

Thanx for replying.

As far as I can see, the "validate" method doesnt't have a return value, You either throw an InvalidInputException or not.

Besides the validator being the wrong place for my implementation (which I can easily move to a post function), this fact doesnt seem the source of my Problem.

I suppose changing the IssueType isn't sufficient enough to do all the neccessary background-steps which probably have to be done to have the workflow working correctly (including the post functions).

Unfortunately Jira display everything fine, the Issue with the new IssueType and the switched Workflow, and doesn't tell me, that something is missing or wrong.

When I use the Move Issue Form to change just the IssueType, everything works fine. So I suggest I will have to look at the Sources of this Action and extract what is need.

regards,

Hans
Hans

This widget could not be displayed.

Hi!

If anybody needs something like this:

The function migrateIssueToWorkflow within WorkFlowManager used witin a transition post function worked for me.

regards,
Hans

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

216 views 3 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you