Create a new issue after manually closing out linked issues

Michelle May 17, 2024

I have an automation that is set up that is supposed to help streamline a business process in Jira. So how the automation is set up currently is:

(Step 1) When an epic is created with the custom field system name, it creates a story called “system 1” and links it to the epic. 

(Step 2) Then the story (system 1) creates three tasks which are all linked to the story.                        Task 1, Task 2, and Task 3


(Step 3) Task 3 has three sub-tasks that are created under that task. 

Note: When the epic is created in the beginning with the system name it created all of these issues at once I.e., story, tasks & sub-tasks. 


The last part I would like to setup is when all of my issues (epic, story, tasks, and subtasks) are transitioned to done (manually). I would like to create a new story called “system 2”. 

How can I achieve this? Can someone please provide some guidance on this? 

1 answer

1 vote
Bill Sheboy
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.
May 18, 2024

Hi @Michelle -- Welcome to the Atlassian Community!

It is unclear from your question which parts of your scenario are already implemented with rules, and which parts may have problems to correct.

For a question like this, please post images of your complete automation rules, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

Which version of Jira are you using: Cloud, Server, or Data Center?  The version you are using will impact which rule features are available to try to solve the scenario.

Kind regards,
Bill

Michelle May 19, 2024

Hi Bill,

Thank you for the warm welcome. I am excited to be here. Please see attached screenshots of my current automation setup in Jira cloud. These are all issues that are created when a user creates an 'Epic' issue type with a system name. 

Issues created --> Story, three tasks, and sub-tasks. 

First automation:

Image 1.jpg

Second automation: 

Image 2.jpg

Third automation:

Image 3.jpg

 

Michelle May 19, 2024

I need to create a fourth automation which would create a new story issue type called 'System 2' once all of these issue are manually transitioned to 'Done'. 

Note: The screenshots shown above are all automations that are properly working. I just need guidance on how to create the fourth automation. 

How can I achieve this?

 

 

 

 

Bill Sheboy
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.
May 19, 2024

Based on the images, you are using Jira Server or Jira Data Center, and not Jira Cloud.  I can see that as the rule editor views are different between Cloud and other versions of automation rules.

 

For your fourth rule to detect when all of the issues are done and then create the new "System 2" issue, the key is: how are these issues related?

If you can write a JQL statement to find all of the issues, you may use the related issues condition to check the status of the group of them.  For example, please decide the TODOs in this outline:

  • trigger: issue transitioned to done
  • condition: TODO identify some condition to confirm the trigger issue is one to check
  • related issues condition:
    • TODO identify JQL to detect all of the issues which are not done
    • and a condition that none were found
  • action: create the new issue

 

Michelle May 24, 2024

I have tried to add an automation that is shown below to close out all issues before creating a new issue type story and this still doesnt execute properly. Can someone help assist with this so I can see how to have all issues create a new issue type when all issues have been set to done manually?

 

Automation.jpg

Bill Sheboy
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.
May 24, 2024

Without seeing your entire JQL statement...

I believe you want the opposite criteria: search for issues which are not done, and the condition is there are none found.

Michelle May 25, 2024

This is the epic, story, and tasks that I would like to transition to done before creating a new story.

Bill Sheboy
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.
May 26, 2024

I understand that part, and I was describing how to check if all of the relevant issues are "done" before creating the new one.

Is your rule working as you expected?

If not, please explain what is not working and post the entire JQL statement used in that condition.  Seeing those may help explain why it is not working.

 

Michelle May 27, 2024

IMG_4327.jpegI am testing the automation in steps. I am trying to see if I can pass the epic and story to be transitioned to be done and create a story then I will add the rest of the clauses. However, it seems that the epic seems to pass the JQL condition however the Story does not seem to be passing and I am unsure why it is not passing when I transition it to done. IMG_4326.jpeg

 

Bill Sheboy
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.
May 28, 2024

As written, that rule cannot work for both Epics and Stories: the JQL conditions you show check if the issue is an Epic and is also a Story.  That is not possible.

If you write this initially as two rules, you may find how to combine them.

For example, the "Epic" test rule would be

  • trigger: issue transitioned to Done
  • issue field condition: issue type equals Epic
  • related issue condition: there are no child issues of the Epic which are not Done
  • action: create the story

The "Story" rule needs to go further, testing its parent also:

  • trigger: issue transitioned to Done
  • issue field condition: issue type equals Story
  • related issue condition, with JQL: the parent issue is Done
  • related issue condition: there are no issues with the same parent which are not Done
  • action: create the story
Michelle May 29, 2024

This is the automations that I set according to what you recommended however it still did not create a new story issue. Here is a screenshot 

 

Michelle May 29, 2024

IMG_4331.jpegIMG_4332.jpeg

Bill Sheboy
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.
May 29, 2024

Please re-read what I described earlier...

For your first rule you show, triggered by the Epic, the Related Issues Condition is incorrect.  I believe you want to use this:

  • related issues: Children
  • condition: None match specified JQL
  • matching JQL: 
issueType = "Story"
AND summary ~ "Pre-Assessment"
AND status != Done

This will confirm there are no remaining child issues for the Epic that are not Done.

 

 

For the second rule you show, triggered by the Story, there is a missing Related Issues Condition:

  • related issues: JQL issues
  • condition: None match specified JQL
  • matching JQL: 
"Epic Link" = {{triggerIssue.Epic Link}}
AND issueType = "Story"
AND summary ~ "Pre-Assessment"
AND status != Done

This will confirm there are no remaining child issues for the same Epic parent as the trigger issue that are not Done.

 

Please make those changes and re-test.  If you find the rule does not work as expected due to not matching conditions, compare your issues to the condition to learn why.

Michelle May 29, 2024

It worked!!! Thank you so much. 

if I want to continue the automation and have the tasks be added so they are also transitioned to done and then create a story will I follow the same step for automation story? And do I need to update the two existing automations for epic and story to include jql issues not match condition and add the tasks in there as well?

Bill Sheboy
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.
May 29, 2024

Would you please clarify what worked and what remains to be done?  It seems you are asking for the same things which were already suggested.

Thanks!

Michelle May 29, 2024

When an epic and story (pre-assessment) is manually transitioned to done the new story (assessment) is created. However, I’d like to add on to the existing automations that are set. So for instance the tasks that are linked to the story “pre-assessment” that was transitioned to done earlier. I would like for the tasks to be manually transitioned to done and then create the story “assessment”. I tried to replicate the steps mentioned above but it did not properly execute. Please see screenshot below: 

IMG_4333.jpegIMG_4327.jpeg

Michelle May 29, 2024

So in hindsite, the epic, story, tasks need to be done and then the story assessment gets created. I was trying to break the automations into parts. So far it works I just need to add tasks to the already existing automations. 

Bill Sheboy
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.
May 29, 2024

Thanks for that additional information.  For the JQL in the rules like this:

issueType = "Story"

Please change them to this so both issue types are included:

issueType IN ("Story", "Task")

 

You may learn more about writing JQL like this with this free training and documentation from Atlassian:

 

Michelle May 29, 2024

Hi Bill, I am a bit confused from your last comment would I only change the JQL for No JQL issues match and then do issue type In (story, task)? 

Because where it says issue matches JQL, is only checking for all task issue types. Not story, since that is part of the other automation you helped setup. Please see screenshot on which JQL statement. IMG_4337.jpeg

Bill Sheboy
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.
May 29, 2024

To confirm: the Epic can have child issues which are Story or Task type, correct?

Michelle May 29, 2024

The epic only has one link to it which is the story pre assessment. And then the story has three tasks links to it as mentioned in the picture.

Bill Sheboy
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.
May 29, 2024

The rule will need different / additional steps when testing for the linked issues.  The previous change I described for issueType IN ( "Story", "Task" ) is not needed.

 

Are you using Jira Server or Data Center version?  The following will only work if you have the Lookup Issues action with Jira Data Center (or Jira Cloud).

  • after the related issues condition you are pointing to in the image...
  • add the Lookup Issues action, adding the same JQL from the condition.  This will load the data for the Story.
  • Now, add another related issues condition to test the linked Tasks
    • related issues: JQL issues
    • condition: None match specified JQL
    • matching JQL: 
issue IN linkedIssues( {{lookupIssues.first.key}} )
AND issueType = "Task"
AND status != Done

Please add any additional criteria needed to identify the needed Tasks.

 

Michelle May 29, 2024

IMG_4342.jpegIMG_4343.jpegI do have the lookup issues function. 
however, when I did that when I transitioned the epic to done it created the new story which shouldn’t happen. Please take a look at my automation screenshots. 


 

 

Bill Sheboy
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.
May 29, 2024

Let's back up a bit, as I believe we are confusing the different rules for the scenario...

Please take a moment to test the JQL used in those conditions and actions with example issues using an issue search to see if they return what you expect.  If not, adjust them.

For example, the Tasks are indirectly related to the Epic, through the Story, and so the JQL you show for the Lookup Issues action cannot work as you expect.

 

The overall scenario now seems to be:

  • there is one Epic, where the System Name is not empty
    • with one child Story, containing the summary "Pre-Assessment"
      • with three linked Tasks, apparently with several possible values in the summary

When all of those are transitioned to Done, you want to create a new Story.

 

You are trying to solve this with multiple rules:

  1. when an issue is transitioned to Done, and it is an Epic, check the child Story and linked Tasks are Done before creating the new Story
  2. when an issue is transitioned to Done, and it is an Story, check the Epic and linked Tasks are Done before creating the new Story
  3. when an issue is transitioned to Done, and it is an Task, check the linked Story and Epics are Done before creating the new Story

 

After testing and reviewing the JQL I believe you will find where to adjust them.  Perhaps show your rules to your teammates also to confirm your understanding of the scenario.

Suggest an answer

Log in or Sign up to answer