Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow condition based on sub tasks fields

Oscar Mastroberti April 25, 2018

Hi! 

I am trying to allow the closure of a Story, based only if its sub-tasks met some conditions around the following fields: Priority, Severity and Status.

For the latter, there is already documentation, but I can't find anything about other fields belonging to the sub-tasks. 

I appreciate all help! 

2 answers

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
April 25, 2018

As far as I know, there is no bundled such condition/validator.

If you know how to write a plugin, just add a validator that checks priority, severity, vice versa as below

@Override
public void validate(Map transientVars, Map args, PropertySet ps) throws InvalidInputException, com.opensymphony.workflow.WorkflowException {
Issue issue = (Issue) transientVars.get("issue");
Collection<Issue> subtasks = issue.getSubTaskObjects();
boolean allHigher = subtasks.parallelStream().allMatch(subtask -> subtask.getPriority().getName().equals("Higher"));
if (!allHigher) {
throw new InvalidInputException("All subtasks should be Higher to proceed this transition");
}
}

You can extend the code to match any, none ...

Hope it helps 

Oscar Mastroberti April 27, 2018

Excelent Tuncay! I will try this ASAP and let you know.

Thanks

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
April 25, 2018

You can do it by implementing your own plugin. You can write condition or validator to allow the transition.

Are you looking for a solution that is already bundled with Jira or marketplace addons?

Oscar Mastroberti April 25, 2018

Hey Tuncay! 

I would like a) bundled in Jira b) Own plugin c) Addon.

Probable b) doesn't exist, right?

 

Thanks

Suggest an answer

Log in or Sign up to answer