I need to create an automation for when I create a new issue in an existing epic.
Asked by Anna Sosnina:

I need a child issue custom field to be updated with the value from the epic's identical custom field value. Basically, the value in the epic for that custom field needs to be copied to the child issue on the create step.


Answers:
author: Mykenna Cepek
body: Before proceeding, I want to restate what I think you're trying to do...

* You have an Epic with custom field that is set to a value.
* You want all the child issues under that Epic to have that same value for that custom field.

We also have to be aware that there are multiple ways an issue can end up as the child of an Epic. Most commonly:

* The issue is created as a child of the Epic (example: using the + icon to the right of "Issues in epic" when viewing an Epic)
* The "Epic Link" of an issue is set to the Epic.
* (fellow experts: am I missing any here?)

If all of the above is correct, then it'll be easiest to implement this with two separate rules:

* First rule:
  * Start with the "Issue created" trigger.
  * Then use an "Related issues condition" to check if the "Epic" "exists" (for the newly created issue). The rule only continues executing if that condition is true.
  * Finally use an "Edit issue" action for the custom field to "Copy from" the "Epic issue" -- and under "More options" you might want to uncheck "send emails" to reduce notifications.

<!-- -->

* Second rule:
  * Start with the "Field value changed" trigger set to monitor the "Epic Link" field for all changes.
  * Then use an "If/else block" condition, and add a "Related issues condition" to check if the "Epic" "exists".
    * Under that condition use an "Edit issue" action for the custom field to "Copy from" the "Epic issue" -- and under "More options" you might want to uncheck "send emails" to reduce notifications.
  * Next click on "Add else" on the left and click "Save". This adds the "Else" clause to the "If" block.
    * Under the "Else" add an "Edit issue" action to clear the custom field -- and under "More options" you might want to uncheck "send emails" to reduce notifications.

Save and publish both rules. Test them in at least these three scenarios to ensure they work as you intend:

* New child issue created within an Epic. The custom field should get copied from the Epic to the child issue.
* Issue not related to the Epic changed to be a child of the Epic (by setting the Epic Link field). The custom field should get copied from the Epic to the child issue.
* Child issue of the Epic removed from the Epic (by clearing the Epic Link field). The custom field should get cleared.

A hidden assumption (using just the above two rules) is that an Epic would have the custom field set *before* any children were added to it.

Additional rules could be added to *enforce* that the custom field stays in sync between an Epic and its child issues. Some scenarios:

* The custom field is changed in the Epic (e.g. to fix a typo). With just the above, none of the existing child issues would get updated, but new children will get the new value.
* The custom field is changed in a child issue. With only the above rules, that will be allowed, and it might then be different from the Epic.
* (fellow experts: any other cases to cover here?)

Additional rules can be added to address the above scenarios, if they are important for your use-case.


author: Jack Brickey
body: Hi [@Anna Sosnina](/t5/user/viewprofilepage/user-id/5394598) , so that I might better assist, is this when the Epic is created or when the story under the epic is created? Also, do we need to b concerned about that field being updated later?

comments: author: Anna Sosnina
body: Hi [@Jack Brickey](/t5/user/viewprofilepage/user-id/853369) , I need it for when a new issue is created under the already existing epic. If I set a field value on the epic, I need that value to be copied over to every child issue under that epic when I create those child issues. We do not need to be concerned about the field being updated later.

Thank you for responding :)


author: Jack Brickey
body: Try this...

![IMG_3322.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/298373i24B5F1A98D54CC4D/image-size/large?v=v2&px=999 "IMG_3322.jpeg")

obviously you will want to edit this to meet your exact needs. Basically what I present above is that when an issue is created, it simply checks to see if there is a parent and if so, it will continue and copy the custom number field from the parent to the current issue. you can add additional conditions to meet your specific needs. Let me know if I can assist further.


author: Anna Sosnina
body: Thank you! I will try it and let you know how it goes. :)