Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation rule- Issue opened under an already closed Epic

Jayme Burkhalter
Contributor
August 5, 2022

I am working on writing an automation that will notify me if an issue has been linked to an epic that has already been marked DONE.

I have already written an automation rule that will auto-close a Parent-Epic if all the children meet the following criteria:

  • Status = DONE or Cancelled
  • FixVersion is not Empty

What I want to do is create an automation rule that will notify me if something changes on an already DONE epic, like:

  • Child issue is reopened
  • New issue linked as a child

So far, I cannot find a way to write the rule for an issue that has been epic-linked.  The only links that are available to choose are things like "deploys, relates to, etc..."

A) is there another way to write this?

B) Is there a way to write an automation rule that prevents changes to issues in an EPIC that has been marked DONE?

2 answers

2 accepted

0 votes
Answer accepted
Mykenna Cepek
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2022

There is a different approach to this. Do you truly need to be notified in real-time that something has been added to a closed Epic? If not, then I might suggest a simpler solution.

Use a Scheduled trigger that runs, say, at 9am and 2pm weekdays. It runs through all the Epics which are Done in the configured projects, and uses a Branch to scan the children of those Epics for anything that is not Done.

A further suggestion (regardless of the approach used) is to rely on the "Status Category" field, not the "Status" field.

Jayme Burkhalter
Contributor
August 5, 2022

@Mykenna Cepek I do not need to necessarily run real time, but pretty soon after so I can check it.  A scheduled trigger may be helpful. Is there an example of how I might write this rule to check for any open issues on DONE epics?

Trudy Claspill
Community Champion
August 5, 2022

@Mykenna Cepek made an excellent point about Status vs. Status Category.

Note, though, that Status Category is not in the list of fields that you can choose from in an Issue Fields Condition in a Rule. You could use a JQL Condition instead.

Mykenna Cepek
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2022

You're right, @Trudy Claspill, it's not an option.

Please, everyone, take a moment and vote for these enhancement requests:

Jayme Burkhalter
Contributor
August 5, 2022

@Mykenna Cepek i created a scheduled rule to check for any open issues in DONE epics and it appears to be working!! yay!  this sends me an email of any issue it finds that does not meet the JQL criteria.  I think this might solve my issue, at least as an MVP.  Nice suggestion! Thank you!

Mykenna Cepek
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2022

Here's an example construct. You'll have to complete it to work like you want:

example.PNG

I used a CRON expression in the Scheduled trigger that will never trigger, so I can use the "Run rule" button to test it while I'm developing the rule.

The JQL for the trigger finds all the completed Epics, and passes that to the rule.

The branch then loops through the child issues of each closed epic, looking for any that are not Done. If any are found, this example uses the Audit Log action to note them in the log.

I'd uncheck the "Only include issues that have changed..." option, just because child issues may have changed underneath Epics that have not changed.

Jayme Burkhalter
Contributor
August 5, 2022

here is the rule in case anyone else was wondering:

image.png

Mykenna Cepek
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2022

I'd recommend using parenthesis around your AND and OR clauses to ensure they are working exactly as you intend.

Gripe: The JQL documentation is not clear on this sometimes. I've seen the docs say that JQL is "evaluated left to right" and also that "AND takes precedence over OR". It can't be both.

You probably want:

status not in ("done", "Cancelled") or (status = done and fixversion is empty)
Like Jayme Burkhalter likes this
Mykenna Cepek
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2022

You don't list the JQL you are using in the trigger. That's important.

Like Jayme Burkhalter likes this
Jayme Burkhalter
Contributor
August 8, 2022

good point, here is the JQL used for the scheduled portion

image.png

Mykenna Cepek
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 10, 2022

Thanks, that JQL isn't ambiguous or concerning at all. Glad you got it working!

0 votes
Answer accepted
Trudy Claspill
Community Champion
August 5, 2022

Hello @Jayme Burkhalter 

Can you show us the Rule(s) you have already tried?

Are you working with a Company Managed project or a Team Managed project?

You cannot use a Rule to block a Status change. That can be done only through the workflow transitions.

I'll do some experimenting on creating a rule that would send an alert in the circumstances you specify, and get back to you (if somebody else doesn't beat me to it).

Trudy Claspill
Community Champion
August 5, 2022

I think you have multiple scenarios to address:

1. When an issue is created and simultaneously (during issue creation) made a child of an epic.

2. For an already existing issue, when it is linked to an epic.

3. For an existing issue that is already linked to an epic and the child issue status is changed. -- This one could potentially be handled by a workflow transition condition blocking re-opening the child issue if the parent epic is in a Done status.

This rule satisfies #1.

Screen Shot 2022-08-05 at 12.10.30 PM.png

Jayme Burkhalter
Contributor
August 5, 2022

@Trudy Claspill The top image is an example of a rule I tried to write for a new issue that gets created and has an Epic Parent but it didnt work.

The bottom two images are the automation rules I wrote to auto-close the epic when the children have all been marked DONE and assigned Fix Versions

Its not so much the creation of the new issue, its when it is epic-linked to a closed Epic

At the very least, I just want to be notified if anything changes on an epic that has already been marked DONE.  If a new issue is added, or put back into a state other than DONE, I need to know to follow up with the team on what's going on.

If I am creating a rule that auto-closes the Epic based on all child stories being DONE and having FixVersions, then I need to know that there is nothing that will compromise the integrity of the DONE status of the Epic.  Checks and Balances :)

image.pngimage.pngimage.png

Trudy Claspill
Community Champion
August 5, 2022

Our responses crossed in the ether. :)

I posted a rule that will handle the scenario of a new issue being added to an Epic that is marked as done. Now here is one that handles a child issue being reopened when its parent Epic is already set to Done. You would replace the Log Action with a Send Mail action.

 

Screen Shot 2022-08-05 at 12.23.14 PM.png

Jayme Burkhalter
Contributor
August 5, 2022

@Trudy Claspill Ahh, awesome, i will try those.  How do I make it send an email to just me for instance? Or perhaps 2 specific people?

Trudy Claspill
Community Champion
August 5, 2022

Creating a rule to check if an existing issue is added to an Epic and the Epic is done is more complex. There is not a built in method to check if the Epic Link field (used in Company Managed projects) is changed.

In responses on this post @Bill Sheboy  goes over using an Advanced Compare Condition to check if the Epic Link field changes.

And this rule satisfies the condition of an existing issue being updated to make it a child of an Epic that is already Done.

Screen Shot 2022-08-05 at 12.49.48 PM.png

Trudy Claspill
Community Champion
August 5, 2022

When you use the Send Mail action you are given a field where you enter the email addresses to which you want to send the message. You also have some options to select user groups and user fields set in the issue.

Like Jayme Burkhalter likes this
Jayme Burkhalter
Contributor
August 5, 2022

@Trudy Claspill Have tried all of these and the rules are not running for some reason.  I need it to run off of the Epic Link field being changed to a DONE epic but that is not a selectable field.  Tried writing the rule like the one above and it did not even run.

Trudy Claspill
Community Champion
August 5, 2022

Please provide specifics of the rule you created and then the event you executed.

Did you look at the audit log for the rule? Does it show the rule is triggered?

Is the rule published and turned on?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events