Script running in one instance but not another

Hi answerers,

I ve got this little script to transition a parent issue:

if ( issue.isSubTask() ) { 
        parent = issue.getParentObject() 
             
        workflowTransitionUtil.setIssue(parent); 
        workflowTransitionUtil.setUsername(currentUser); 
        workflowTransitionUtil.setAction(11) 
        
        CommentManager commentManager = (CommentManager) ComponentManager.getComponentInstanceOfType(CommentManager.class); 
        commentManager.create(parent, currentUser, "Foo", true); 

        workflowTransitionUtil.validate(); 
        workflowTransitionUtil.progress();
		log.debug("finished")
}

This is run correctly in one instance of JIRA (6.2.5), but on a second instance (6.2.7) only the comment is created but the parent is not transitioned. The second instances has some more conditions on the transition, but as I can trigger it manually that shouldn t be the problem.

The log shows in both cases the "finished" message and no errors - I have no clue at the moment where to look further.

Any hint is appreciated!

Thanks in advance,
Thomas

2 answers

1 accepted

This widget could not be displayed.

In addition to what Alexey said.

To be honest if it works on one but not the other, you have everything you need to solve it. Just binary chop until the instances are the same, then you will see what was causing it.

Don't ignore workflowTransitionUtil.validate(), it returns an ErrorCollection.

log.debug "Validation errors: " + workflowTransitionUtil.validate();

should be sufficient.

That was it! The validator had some errors because not all custom field were the same.

This widget could not be displayed.

1. Are you sure tat you have set proper actionid? Maybe on you second instance there is slightly different workflow for parent

2. workflowTransitionUtil.validate and .progress methods return ErrorCollection as execution result. Please try to check the content of them (see https://docs.atlassian.com/software/jira/docs/api/latest/com/atlassian/jira/workflow/WorkflowTransitionUtil.html and https://docs.atlassian.com/software/jira/docs/api/latest/com/atlassian/jira/util/ErrorCollection.html)

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...

232 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