Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automate parent transition based on subtasks multiple states

Hello everyone! 

we have project with a kanban board with many columns:

- backlog

- selected for development

- in progress

- done

we're using a parent/subtask structure for every issue in the board. What we want is to make multiple controls on the siblings subtasks to control the transition on the parent. 

Basically what we'd love is, whenever a subtask transitions from a status to another one:

- if there is at least one sibling task in "in progress" the parent task will move to (or stay in) "in progress"

- else if there is at least one sibling task in "selected for development" then the parent will move to (or stay in) "Selected for Development" 

- else if there is at least one sibling task in "Backlog" then the parent will move to (or stay in) "Backlog"

Please note that "In progress" takes precedence over "Selected for Development" and "Selected for development" takes precedence over "Backlog".

Right now we're able to make just one of these controls but we're struggling to make all of these controls whenever a transition of a subtask occurs. 

Any ideas?

1 answer

Hi @gmastrandrea  -- Welcome to the Atlassian Community!

For a question like this, please consider posting an image of your current rule and of the audit log from an execution.  That will provide context to the community to offer ideas.  Thanks!

You probably can do this with related issues conditions, yet I have seen challenges with those...so...

Instead you could use Lookup Issues, JQL, and created variables to capture the count of issues (sub-tasks) in each condition, and then use if/else to find the correct path, and then branch on the parent to perform the update transition.

Best regards,
Bill

Hello Bill! Thanks for your interest. Here's the main rule that we use. 

The main problem we're struggling with is that we can't find a way to use an if/else structure in the "Parent" branch rule. 

I'd like to investigate, though, your suggestion about creating variables to count the issues in each condition. Where can i read more about this topic?

Schermata 2021-07-14 alle 17.56.13.png

Hi!

Yup, that nesting issue is why I suggested gathering the information first, use if/else on the results, and then branch inside the if/else clauses.  The opposite is not supported, as you note.

To learn more about created variables, please look here:

https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Createvariable

To learn more about lookup issues, please look here:

https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Lookupissues

If you get stuck, please let me know.  Thanks!

Like gmastrandrea likes this

@Bill Sheboy thanks for the docs links!

I gave a try to the approach you suggested, and i think i'm pretty close to what we want to achieve. Here's our rule. It's a bit long, but the custom variables i created with lookup issues do work well and in the parent comment i have the right numbers. 

Apparently, though, something is not working properly with the "if" statements. The task execution simply won't enter the if conditions and the parent won't be transitioned nor commented. 

Any suggestion?

 

advancedparenttransition.png

Hi!  It is a bit hard to see the details, but it appears you have extra spacing in the smart values, such as {{ myfield }} so perhaps try removing those first: {{myfield}}

Next, I suggest that as you create each variable, add it to the audit log.  That will confirm it has an expected (or unexpected) value for your testing.

Finally, if you are performing math operations on some of the values, so you may need to do something like below.  The reason for that is created variables cannot be used as parameters to smart value functions...yet.

{{#=}} {{myFieldA}} + {{myFieldB}} {{/}}

Please look here for more details:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-math-expressions/

Like gmastrandrea likes this

Hello @Bill Sheboy , here's a partial reduced case:

Schermata 2021-07-16 alle 10.14.16.png 

What i'm trying to do is creating a new variable holding the number of siblings of a transitioned tasks that are in "in progress" status. The comment task has debugging purposes and is logging the proper number of siblings in "in progress" state (2, in my case). 

The trouble comes when the if clause is executed. The audit log just says:

Schermata 2021-07-16 alle 10.20.18.png

I believe created variables are strings, so please try this in your comparison condition:

{{inProgressSiblings.asNumber}}

Unfortunately, i have no luck putting "asNumber" in the condition. 

Here's the complete rule, the audit log says the same ("The following issues did not match the condition", followed by the triggering issue key):

Schermata 2021-07-19 alle 09.40.59.png

That's curious... would you please post an image of the component where you create the {{inProgressSiblings}} variable?

And, would you please explain why in some cases you are adding spaces around smart values and in other cases you are not? For example:

parent = {{ inProgressSiblings }} AND status = "In progress"

I believe that formatting is only needed for certain math functions.

Yes, here you go:

Schermata 2021-07-20 alle 09.42.33.png

For what concerns your question, it's just because when i use template engines using those extra spaces improves the readability of my code. 

BTW, unfortunately deleting all the extra spaces does not change the result of my rule. It's always "The following issues did not match the condition"

Thanks, and as I noted: in some cases extra spacing in the smart values is required and usually it is not.  Just an FYI in case things don't work as expected for your rules.  For example, in your post to the audit log the value does not appear to resolve to a number.

Let's try three things: remove the extra spacing from the JQL for your Lookup Issues:

parent = {{triggerIssue.parent}} AND status = "In progress"

And please change your created variable value to add a default value of 0:

{{lookupIssues.size|0}}

And then post the created variable to the audit log without the extra spacing.  This should confirm if there is a non-zero value from the Lookup Issues action JQL.

Thanks!

Hi @Bill Sheboy!

I tried everything you suggested, here are the automation rule and the audit log:

Schermata 2021-07-22 alle 14.41.47.pngSchermata 2021-07-22 alle 14.41.29.png

Hmmm...I have one more thing to suggest to rule out a problem with the condition type:

  1. In your compare replace the created value with the source value: {{lookupIssues.size|0}} and re-test
  2. And then, rather than using the if/else condition, substitute an Advanced Compare Condition and test again using the created variable {{inProgressSiblings}}

If both of those work then there is some problem with your smart value and the if/else condition type.

At that point, I suggest asking your site admin to submit a support ticket to Atlassian here: https://support.atlassian.com/contact/#/

They will be able to see things in the logs which end-customers cannot see, and so may steer us toward a cause/solution.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

63 views 0 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you