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

redcabin April 5, 2013

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

0 votes
Christian Czaia _Decadis AG_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2013

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

0 votes
Miroslav Kozel September 11, 2013

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

Suggest an answer

Log in or Sign up to answer