Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,867
Community Members
 
Community Events
165
Community Groups

Find subtasks of a specific type in a specific state

Hello, I tell you my problem:

A short time ago I created a new issuetype that has a subtask format (this issue is called blocking), after creating it I found myself looking for an automation that solves the problem that I will comment on below:

1) I need an automation that marks with a flag when a story has as a child a lock in the active state (the lock only has the active and done states).

2) The second automation should "remove" the flag when the history has all locks in the Done state.

I already did the first automation, but the second is the one that leaves me with the most doubts, since I don't know how to search among all the subtasks that have a history, only those that are of the blocking type and that are done. Since if a story has 2 blocks, one active and one finished, it should be marked with the flag, but when the one that is active passes to done, the flag should be removed. In addition, within that story there may be common subtasks (those that come by default in Jira) and the locks that I just mentioned.

1 answer

Hi @Marcelo Cid _Antiguo_ 

Just to confirm you're looking for two rules (one of which works)...

  1. Add Flag if an Issue has any open "Blocking" Sub-task
  2. Remove Flag if an Issue's "Blocking" Sub-tasks are all in Done

If yes, I've provide both rules below, just for clarity.

 


Rule 1 - Add Flag:

  • Trigger: Issue Created
  • Condition: Issue Fields Condition
    • Issue Type = Blocking
  • Branch: Related Issues = Parent...
    • Condition: Issue Fields Condition
      • Flagged is empty 
    • Action: Edit Issue
      • Flagged = Impediment

^ I've used Issue Created as issues are created in an open Status, thus avoiding the need for additional conditions based on Status.

 


Rule 2 - Remove Flag:

  • Trigger: Issue Transitioned
    • To Status: Done
  • Condition: Issue Fields Condition
    • Issue Type = Blocking
  • Branch: Related Issues = Parent...
    • Condition: Related Issues Condition
      • Related Issues: Sub-tasks
      • Condition: All match specified JQL
      • JQL: issuetype = Blocking AND status = Done
    • Condition: Issue Fields Condition
      • Flagged is not empty
    • Action: Edit Issue
      • Flagged = NULL - leave it empty

^ Using the first Condition in the Branch, to check all the Parent's Blocking sub-tasks each time the rule is triggered, will ensure it is only executed when all the relevant children are in the Done Status.

 


Let us know if this works for you!

Ste

Hello @Stephen Wright _Elabor8_ 

Thanks for helping.

I send you a picture of how the automation you said should be (to verify that I am correct)

Auto.png
Even so, the automation does not work for me, there is the possibility that in addition to having blocking-type subtasks it also has "normal" subtasks (the ones that come by default in jira). However, the automation I'm looking for is independent of Jira's subtasks and specific to the blocking one.

his.png

 

When block 1 and 2 are done the history flag should be removed

Hi @Marcelo Cid _Antiguo_ 

Looks like I made a minor error in Rule 2 - the Branch logic should be...

  • Branch: Related Issues = Parent...
    • Condition: Related Issues Condition
      • Related Issues: Sub-tasks
      • Condition: All match specified JQL
      • JQL: issuetype = Block AND status = Done
    • Condition: Issue Fields Condition
      • Flagged is not empty - correction added here
    • Action: Edit Issue
      • Flagged = NULL - leave it empty

I've corrected this in the original answer also.

The rule is specific to "Block" sub-tasks, and should ignore the normal sub-tasks because of the JQL in the Related Issues Condition - which stipulates that it's only relevant to "Blocks".

Ste

Hi @Stephen Wright _Elabor8_ 

2.png

Automation still doesn't work :/

 

I just did the test when I only have blocking type subtasks and not the "normal" ones and the rule works fine. However, it is not the solution I am looking for.

Hi @Marcelo Cid _Antiguo_ 

Another option, using a different Related Issues option in the Branch

From Rule 2...

  • Branch: Related Issues = Parent...
    • Condition: Related Issues Condition
      • Related Issues: JQL issues - change added here
      • Related Issues JQL: issuetype = Block
      • Condition: All match specified JQL
      • Matching JQL: status = Done
    • Condition: Issue Fields Condition
      • Flagged is not empty
    • Action: Edit Issue
      • Flagged = NULL - leave it empty

^ I tried this with some different parameters, and it seems to work as required.

Ste

Hi @Stephen Wright _Elabor8_ 

The automation you sent me works super well, thank you very much.

Now I ran into another problem, when I try to leave myself as a global rule for about 8 projects it doesn't work :/

 

a.png

I tried all the ways in the scope section but still did not have good results

@Stephen Wright _Elabor8_ Any idea why the automation doesn't work?

Suggest an answer

Log in or Sign up to answer
TAGS

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