How to create Jira Automation rule for - Send email when all stories for an epic are done
Asked by Justin Princehorn:

Hi, I have a jira project that has only epic issues and then a second project that has only user story issues. The user stories are linked to the epics from the other project.

I'd like to write a jira automation rule so that anytime a user story is marked Done, I want a rule to trigger that essentially does the following:

1. Checks if all other stories in that same epic as the triggering story issue are already marked Done

2. IF True, then send an email.

So far I've tried using the following steps:

1. Trigger - when a issue transitions to Done

2. Condition - Check for related issues using jql **"epic link" = {issue.parent.epiclink}** and the condition for those all matching this specified jql **status = Done**

**However, the epic link jql noted above is not acceptable syntax and can't figure out how to write it.**

3. Action - if condition true, send email

Please help!

Thank you,

Justin


Answers:
author: Mikael Sandberg
body: Hi [@Justin Princehorn](/t5/user/viewprofilepage/user-id/4773839),

Welcome to Atlassian Community!

You could use the "When all stories are completed ? then close epic" automation in the Library as your start

![Screen Shot 2022-02-23 at 10.23.59 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/185065i873DF9EA3926BBFF/image-dimensions/208x359?v=v2 "Screen Shot 2022-02-23 at 10.23.59 AM.png")

Instead of the transition at the end, replace that one with the Send email action.

comments: author: Justin Princehorn
body: Hi Mikael,

I tried that but no actions are performed when the rule triggers.

see snapshot

Any suggestions?

![3F377B66-AA79-4535-9C31-AD6AF7B2F30C.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/185084i7828FEE76A5960A8/image-size/large?v=v2&px=999 "3F377B66-AA79-4535-9C31-AD6AF7B2F30C.jpeg")


author: Mikael Sandberg
body: I missed that you are dealing with two different projects. In this case you have to configure the automation to be under the Global administration, then from the Rule details you can change the automation to be for multiple projects.


author: Justin Princehorn
body: Thank you! I will need to work with the jira admin I think to try this out. I'll let you know if that does the trick.


author: Justin Princehorn
body: Great news! It worked after those edits.

I really appreciate the assist on this.

thanks!


author: Justin Princehorn
body: Hi, I'm building more in the body email of the alert.

I'm trying display a bulleted list of all the child issues under the epic in play with this automation rule.

I'm trying to do this with using the LookupIssues function.

see pic below on how I place it in the email body.

I read that you have to define what is LookupIssues... so my attempt is shown in 2nd pic below. But instead of specifying "LPL-98" epic , I want to make that part a smart value and be dynamic. Basically I'm struggling to write successful JQL for this LookupIssues Jira rule action.

any help is super appreciated!

![653A4945-73E6-4F44-9F1D-8F1D487742AD.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/185926iE709C82053FC4E01/image-size/large?v=v2&px=999 "653A4945-73E6-4F44-9F1D-8F1D487742AD.jpeg")![C1C52CBB-8651-457C-84A5-36F2118FAA72.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/185925iF73D2A02F2A3B185/image-size/large?v=v2&px=999 "C1C52CBB-8651-457C-84A5-36F2118FAA72.jpeg")


author: Mikael Sandberg
body: You should be able to use {{issue.key}} in your lookup query, since you at that point is on the epic level, not the triggering issue.


Tags: cloud

confluence-cloud