Is it possible to get the total number of links with conditions

Daniel Brown October 26, 2017

 

 

So I have a very bizarre use case. 

The short question: Is it possible to iterate through all linked issues, and if they meet a condition, increment a value? Or even better, simply get a value of linked issues that meet a condition?

Use case: I have two tasks, one Art, one Programming. The Programming tasks has multiple Art tasks linked to it using a custom link type. When any of the linked Art tasks are completed, I want to update a field (we'll call Percent_Complete from here on out) on the Programming task that shows the percentage of Art links completed.

For example: the Programming task has 4 Art tasks, and as they are completed, I want the Percent_Complete field to reflect 0, 25, 50, 75, and 100 as each are transitioned to Done.  

Once all of the linked tasks that meet the specific condition are completed, we want to comment and transition the Programming task. This is something I know is 

The need for a condition comes from there being multiple linked issues, and not all of which are relevant for Percent_Complete

And because this isn't already bizarre enough, the final value must be a numeric field, otherwise it won't sort properly in the filter view. 

------------------------------------------------------------------------------------------

I intended to use unlisted issue fields to quietly store task-specific information, however the issue I kept running into was whenever I iterate through the linked Art issues, I don't believe I couldn't increment a field back on the Programming task.

Any help would be greatly appreciated. 

1 answer

1 vote
andreas
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.
October 26, 2017

Hi Daniel,

So iterating over linked issues (or checking if they all or some meet a condition) can be done.

  • To iterate use the 'Branch rule / Related issues' action with 'JQL'. Then with JQL and smart-values you can filter out exactly which linked issues. E.g.: 
    issue in linkedIssues({{issue.key}}, "duplicate") AND type = Bug
    (see linkedIssues())
  • To check for a condition you can use the 'Related issues condition' using similar JQL to the above.

Resolving an issue once all it's children are resolved is also possible:
https://community.atlassian.com/t5/Product-Apps-questions/How-can-I-transition-the-parent-when-all-subtasks-are-resolved/qaq-p/159407

 

Now the thing that's not possible yet is calculating percentages of when related issues get resolved. We have an issue open to track this request: https://codebarrel.atlassian.net/browse/AUT-225

We've got quite a few higher priority items in our backlog at the moment so it will be a while before we can get to this, but we'll let you know when we get a chance to work on this.

Cheers,
  Andreas

Daniel Brown November 1, 2017

Hey Andreas,

Thank you so much for the quick response, and thank you for adding our use case to your backlog. With your help I was able to implement a disgustingly janky workaround. 

Whenever an Art task is completed, a rule will execute and check if the state is now "Done". If so it will iterate through all of the currently linked issues as you described and for every linked Programming task and increment a "hidden" field called "_art_tasks_completed". 

Whenever the issue field "_art_tasks_completed" is updated, even by a rule, yet another rule will use that field, and one final "hidden" field named "_art_tasks_total" and update a final "visible" field. 

As a result of this workaround, I have a follow-up question that I can copy into a new thread if you'd like. 

I am familiar with the {{#increment}}{{/increment}} operator; is there a way to decrement a value? 

Thank you!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events