Automation for Missing Parent Epic Name
Asked by Rachel Stein:

Hi! I want to create an automation that fills in the Parent Epic Name field if it is missing, by connecting it to the Epic the issue was created under.

For example, if a feature is created under my "Deals" Epic, but the Parent Epic Name wasn't filled out, the automation would automatically fill the Parent Epic Name field out with "Deals" (i.e. the Epic name)

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

I've drafted this automation but this is not doing what I want. The JQL is finding features/capabilities with missing Parent Link instead of missing Parent Epic Name field.

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

Anyone know how to adjust the JQL for this? Thanks in advance!


Answers:
author: Trudy Claspill
body: Hello [@Rachel Stein](/t5/user/viewprofilepage/user-id/5476409)

Can you explain the issue type hierarchy for your system?

Are Feature and Capability issue types that you can create as child issues under an Epic directly?

As [@Mikael Sandberg](/t5/user/viewprofilepage/user-id/853579) showed, if you have the Parent field in your issues then that field will show the key and summary for an issues parent issue You don't need to copy the information to a separate field in the child.

But, if you insist on doing that, and if Feature and Capability are issue types that can be set as children of Epics then I think the query you want is:

```
issuetype in (Feature, Capability) and Parent is not empty and "Parent Epic Name" is empty
```

That will get you all Feature and Capability issues that are the child of another issue and that have no value in their "Parent Epic Name" field.

To set that field to the Summary from the issues Parent you would use this smart value as the value for the field:

{{issue.parent.summary}}

However, I think your rule still might not work as you expect it to.

Are your running a JQL statement in your Schedule trigger? I ask with a scheduled rule that runs a JQL in the trigger you will execute the "For: JQL" branch for each issue found in the trigger's JQL statement.

comments: author: Rachel Stein
body: Thanks - appreciate the JQL. This did not work as you expected - it assigned the Parent Epic Name to the Parent, which in this meant all my features got the Capability's name instead of the Epic's name.

I am not running a JQL in the scheduled trigger; I just have it set to run every morning and check through any issues that were added to Jira the day before and make the corrections on issues that satisfy the JQL query.

Any more suggestions for working around this?


author: Trudy Claspill
body: Can you explain the issue type hierarchy for your system?

Are Feature and Capability issue types that you can create as child issues under an Epic directly?

For which issue types are you trying to fill in Parent Epic Name?

Are those issue types direct children of Epics?


author: Rachel Stein
body: Hierarchy is as follows: Epic -\> Capability -\> Feature. I am interested in filling out the Parent Epic Name field of features with the Epic name.

For example, for a feature called "Project XYZ" which is nested under the Epic called "Deals", I want the Parent Epic Name field for that feature to list "Deals".


author: Trudy Claspill
body: Is the Parent field in the Feature filled with the issue key of the Capability issue? Or are the feature and Capability connected using generic issue linking?


author: Rachel Stein
body: The parent field in the feature is filled out with the issue key of the Capability issue.


author: Trudy Claspill
body: Great! That makes this easier.

The JQL to use would be:

```
issuetype in (Feature) and Parent is not empty and "Parent Epic Name" is empty
```

That will get the Features that **do** have a parent Capability and **don't** have a value in their Parent Epic Name field.

To set the Parent Epic Name field in the Feature to it's "grandparent" Epic's Summary you would would use this smart value as the value for the field:

{{issue.parent.parent.summary}}

Get the summary from the parent (Epic) of the parent (Capability) of the issue (Feature).

Before the edit action you might want to add a condition to confirm that the Capability is actually the child of an issue (Epic)

![Screenshot 2024-08-29 at 1.40.31?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/344668iCCB46118A41539B6/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 1.40.31?PM.png")


author: Rachel Stein
body: Wow, that worked!! Thank you so much for your help, this was a great learning experience for me!!


author: Mikael Sandberg
body: What you are looking to do in JQL is not possible in the out-of-the-box version. You are looking to do a nested query and that can only be done if you have an app from the [Marketplace](https://marketplace.atlassian.com/search?query=JQL) that extends JQL to allow queries like that.

But why do you need to set the Parent Epic Name field when the parent name will show up in the Parent field?

![Screenshot 2024-08-28 at 7.58.21?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/344288iD8C9ECEDE7079B38/image-dimensions/352x133?v=v2 "Screenshot 2024-08-28 at 7.58.21?AM.png")

comments: author: Rachel Stein
body: Thanks for the reply. The reason I want Parent Epic Name to be filled out with the Epic is because for my Power BI connection, I do aggregations of information at the feature level but show it at the Epic level. Therefore, I need every feature to have the corresponding Parent Epic Name filled out so it flows through correctly to my Power BI.


Tags: cloud

jira-cloud