how create a new issue after two different issues have been transitioned
Asked by Lex Baldridge:

hello,

I am trying to use automation to create an issue after 2 different issues have been transitioned to the "done" status. I can figure out how to create an issue after 1 different issue is transferred, but I cannot figure out how to do the same thing with 2 different issues


Answers:
author: Trudy Claspill
body: Hello [@Lex Baldridge](/t5/user/viewprofilepage/user-id/5514050)

Welcome to the Atlassian community!

Can you provide a more detailed explanation of your use case?

Are the two issues in the same project or another project?

Are you going to need this for various pairs of issues? If so, how do you determine which two issues are in the pair? Do you link the two issues together in some manner?

You could set up an automation that is triggered by the transition of an issue to "done". Then you would set up steps to find out if the other issue in the pair is currently in a "done" status also. If it is, then you would execute the step to create the new issue.

The exact steps of "find out if the other issue in the pair" is done depends on what information is available in the two issues to identify the other issue in the pair.

comments: author: Lex Baldridge
body: The two issues are in the same project.

I currently have it to where issue 1 (ME gate 2) once transitioned creates Issue 3 (review).

However, Issue 1 and Issue 2 (tooling) is created by the same transition trigger (progress -\> done) with 2 separate rules.

I need to figure out how I can get both issue 1 and issue 2 to both be completed before creating issue 3


author: Trudy Claspill
body: Based on the data available in Issue 1 and Issue 2, is there any way to identify that Issue 1 and Issue 2 are related to each other?

There must be something available from Issue 1 that identifies Issue 2, and from Issue 2 that identifies Issue 1. Otherwise there is no way to create a rule that bases the creation of Issue 3 on both Issue 1 and 2.


author: Lex Baldridge
body: The issues both have totally different sub tasks but they do come from the same epic, so I'm not sure if I can relate them like that.


author: Trudy Claspill
body: Are the two issues the only child issues under that Epic?

Do they have some static value or common value used in both issues, in the Summary or another field, that will make them identifiable as a unique pair under the Epic?

You said each of these two issues is created by a different automation rule. Can you tell us more about the rules that create Issues 1 and 2?


author: Lex Baldridge
body: There is a total of 4 children

* Me gate one (part eval)
* Tooling
* ME Gate 2
* Review

to create Tooling and ME Gate 2: Part Eval is transitioned from in progress to done.

![Capture.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/328173i7DAA40853677D765/image-size/large?v=v2&px=999 "Capture.PNG")

![Capture 2.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/328174i2F2621ED47703878/image-size/large?v=v2&px=999 "Capture 2.PNG")

Both ME gate 2 and Tooling share the same Custome issue field, which is a part number, however, all the children share this Custome field.


author: Trudy Claspill
body: I see that one of these issues is issue type "Tool Crib Prep" and the other is "Imp Continuous Improvement". Will this be the only pair of issues under the Epic that use those issue types? If so, that could be used as the identifier in the rule.

If they are not the only issues of those types under the Epic, then will this pair of issues always use the Summary values of "M.E. gate 2" and "Tool Crib"? And will they be the only issues in the Epic that use those exact Summary values? That could be another way to identify the pair of issues.


author: Lex Baldridge
body: These are all of the issue types, also when I was attempting to do the summary equals "" it would throw errors. The summary values for all of them are the name then the custome field![Capture 3.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/328344iAFC4A2A5CA8200DC/image-size/large?v=v2&px=999 "Capture 3.PNG")


author: Trudy Claspill
body: If "M.E. gate 2" is the only child issue in the Epic that has an issue type of "Imp Continuous Improvement"...

And if "Tool Crib" is the only child issue in the Epic that has an issue type of "Tool Crib Prep"...

Then you could build your rule like this:

```
1 Trigger: Issue Transitioned
    To status: Done
2 Condition: Issue Fields Condition
    Field: Issue Type
    Condition: is one of
    Value: Tool Crib Prep, Imp Continuous Improvement
3 Condition: Related Issue Condition
    Related Issues: Parent
    Condition: exists
4 Action: Lookup Issues
    JQL: parent = {{issue.parent.key}} and issuetype in ("Tool Crib Prep", "Imp Continuous Improvement") and status=Done
5 Condition: {{smart values}} condition
    First value: {{lookupIssues.size}}
    condition: equals
    Second value: 2
6 Action: Create Issue
```

1. The rule is triggered by an issue transitioning to Done.

2. The rule will continue only if the issue that transitioned is one of the issues in the pair, as determined by the issue type being either Tool Crib Prep or Imp Continuous Improvement.

3. The rule will continue only if the issue that transitioned has a parent issue (is a child of an Epic).

4. When all the conditions are met, then look up all the child issues of the trigger issues parent where those issues are of the issue types in the specified pair and the statuses are Done. If both issues in the pair are now done, then this should return exactly 2 issues. If one of the pair is not yet Done, then the rule will stop at this point.

5. The rule will continue only if the Lookup Issues action returned exactly 2 issues.

6. Create the new issue.


Tags: cloud

jira-work-management-cloud