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


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,

2 answers

1 vote

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.




If anybody needs something like this:

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


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

1,200 views 17 10
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