when I add a condition on a transition of my workflow and hide it,i cannt go to the next step.Help

I add a condition on a transition of my workflow for hiding the button on the from transitions-all.

but I found I cannt go to the next step .

my condition is that:

public class NoShowButtonCondition extends YhdWorkflowCondition{

    @Override

    public boolean passesCondition(Map transientVars, Map args, PropertySet ps) throws WorkflowException {

        return false;  //To change body of implemented methods use File | Settings | File Templates.

    }

}

my code for go to the next step of workflow is below:

IssueInputParameters issueInputParametersBussiness = issueService.newIssueInputParameters();
issueInputParametersBussiness.setAssigneeId(parentIssue.getAssigneeId());
issueInputParametersBussiness.setComment("update the state of the workflow");
issueInputParametersBussiness.setResolutionId(parentIssue.getResolutionId());


IssueService.TransitionValidationResult transitionValidationResult
    = issueService.validateTransition(user, parentIssueId, nextActionid, issueInputParametersBussiness);

if (transitionValidationResult.isValid()) {
	IssueService.IssueResult transitionResult = issueService.transition(user, transitionValidationResult);
	if (transitionResult.isValid()) {
	    System.out.println("OK");
	} else {
	    System.out.println("SORRY");
	}
} else {
	List<String> errorList = new ArrayList();
	errorList.addAll(transitionValidationResult.getErrorCollection().getErrorMessages());
	for (int i = 0; errorList != null && i < errorList.size(); i++) {
	    System.out.println("the error msg is :" + errorList.get(i));
	}
}

and the transitionResult.isValid() is false and the error mesage is below

It seems that you have tried to perform a workflow operation (xXXXX) that is not valid for the current state of this issue (TRIDENT-61).

The likely cause is that somebody has changed the issue recently, please look at the issue history for details.

who can tell me what the reason is and how i can program

I want to hide the button on the workflow and go to the next step by programing

TKS!!!

2 answers

Hi, have you got an answer or have solved this? I am facing to similar problem now. Thanks

Hey, this is not a solution but the Misc Workflow Extensions plugin has the "hide transition" condition by default selectable from the UI:

https://marketplace.atlassian.com/plugins/com.innovalog.jmwe.jira-misc-workflow-extensions

Depending on your JIRA version it's free of charge:-)

Cheers

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

77 views 0 11
Read article

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