Create Epics and Stories automation after a Initiative is Created
Asked by GeeLong:

Hi there - Seeking suggestions for creating a series of Epics and Stories after an Initiative is created manually.   

When an Initiative is created, the following to be created via jira automation

* Create 3 Epics and
* 6 Stories to be assigned under each these Epics

As a starting point, have setup an automation to create an Epic and Story. There were errors and didn't manage to go further from here.  

Below are my observations   

1. Epic and Story were created

2. Parent of Story was not linked.

3. Based on the audit log it appears conditions were not met.

![Screenshot 2024-02-07 181927.png](https://community.atlassian.com/t5/image/serverpage/image-id/304828i1ADD363AD6597091/image-size/large?v=v2&px=999 "Screenshot 2024-02-07 181927.png")

Rules to create Epic and Story

![Screenshot 2024-02-07 182605_2_1.png](https://community.atlassian.com/t5/image/serverpage/image-id/304829i7C9022CDA2DFBFFC/image-size/large?v=v2&px=999 "Screenshot 2024-02-07 182605_2_1.png")![Screenshot 2024-02-07 182531_3.png](https://community.atlassian.com/t5/image/serverpage/image-id/304830i4FADEF27AD5C22F1/image-size/large?v=v2&px=999 "Screenshot 2024-02-07 182531_3.png")  

<br />


Answers:
author: Joseph Chung Yin
body: [@GeeLong](/t5/user/viewprofilepage/user-id/5287097) -

In your env, Initiative is a parent of Epic right? What is your issue hierarchy configuration?

Typically, your rule should set story's epic link to the Epic issue key. For your Epic issue, your rule should set Parent Link using the advanced section with codes similar below

```
{
  "fields": {
     "Parent link": "ISSUE_KEY_HERE"
  }
}
```

Hope this helps and please advise us your response on my questions above.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

comments: author: GeeLong
body: Hi [@Joseph Chung Yin](/t5/user/viewprofilepage/user-id/396739)   

Thanks for sharing.   
Yes. You are spot on the hierarchy I am using. (Initiative - Epic - Story)  

Have attempted to use "Parent link" however, an error has appeared.   
![screenshot 2023-12-06 164555.png](https://community.atlassian.com/t5/image/serverpage/image-id/306253i72C276383D5830A6/image-size/large?v=v2&px=999 "screenshot 2023-12-06 164555.png")  
However, when using this field in the automation, it worked   
![Screenshot 2024-02-14 114837.png](https://community.atlassian.com/t5/image/serverpage/image-id/306254i428FB6871AB9C1D2/image-size/large?v=v2&px=999 "Screenshot 2024-02-14 114837.png")  
Based on your suggestion, how can I apply to a Story?   

Even when I replicate the smart value suggested, the Story created in the automation was not linked to the Epic.   

Any possible workarounds?   

Thanks   


author: Joseph Chung Yin
body: [@GeeLong](/t5/user/viewprofilepage/user-id/5287097) -

In your automation rule, after the EPIC is created, can you provide the action configuration on how you create the Story?

BTW you cannot use "Parent Link" to establish Story to Epic roll-up. You can try "Epic Link" in the code.

Lastly, you may need to add the action of "Refresh issue data" either after the Epic is created and before your creation of Story action. Or try to add the same action for the Story and then update the Story issue to roll up to the Epic.

Please advise.

Best, Joseph


author: GeeLong
body: [@Joseph Chung Yin](/t5/user/viewprofilepage/user-id/396739) - on Jira it is indicated Epic Link will be deprecated and replaced by Parent based on the cloud version I am using. So using it might not work in the long run.   

As suggested I have added "Re-fetch Issue data" and "Epic Link" in the advanced section, of which came up with an error.   

![Screenshot 2024-02-15 114456_2.png](https://community.atlassian.com/t5/image/serverpage/image-id/306481iAADE9DF47DF74BAB/image-size/large?v=v2&px=999 "Screenshot 2024-02-15 114456_2.png")  

Rule used for Story  

![Screenshot 2024-02-15 113708.png](https://community.atlassian.com/t5/image/serverpage/image-id/306483i0AE9EFDC312CC20B/image-size/large?v=v2&px=999 "Screenshot 2024-02-15 113708.png")  

<br />


author: Megha Rajanna
body: HI [@GeeLong](/t5/user/viewprofilepage/user-id/5287097) Can you check this out

Trigger:

* When: Issue created
* Issue matches: Type = Initiative

Conditions:

* None (or specify any additional conditions as needed)

Actions:

1. Create issue: Epic 1

   * Summary: \[Specify Summary\]
   * Description: \[Specify Description\]
   * Project: \[Specify Project\]
   * Link to Initiative: {{issue.key}}
   * Store the Epic key in a variable: epic1Key
2. Create issue: Story 1 (under Epic 1)

   * Summary: \[Specify Summary\]
   * Description: \[Specify Description\]
   * Project: \[Specify Project\]
   * Parent Issue: {{epic1Key}}

Repeat the above steps for creating the remaining Epics and Stories.

Thank you

comments: author: GeeLong
body: Many thanks for responding [@Megha Rajanna](/t5/user/viewprofilepage/user-id/5174399) .   

With "Store the Epic key in a variable: epic1Key" I do not have that field in Jira, is that a custom one to be created?


Tags: automation

jira-cloud

jira-service-desk-cloud

jira-service-management-cloud