Automation rule to set an Epics field value based on information from its issues

Kasper Sørensen June 25, 2021

On my Roadmap Plan all issues with the Team field set to "Team X" shows up.

Here's what I'm trying to do:

  • I wish Epics to show if any of the issues in that Epic, has a team field that equals "Team X"
  • I don't want to show Epics in the plan if none of its issues have a Team field that equals "Team X"

I can manage this manually by setting the Epics Team field to "Team X" or clearing that field value. However, this is a bit unreliable.

My logic tells me I should be able to use an Automation rule here to check for a true/false statement.

  • If any of the issues in a given Epic has Team field value = "Team X", set the Epics Team field to "Team X"
  • If none of a given Epics issues has a Team field value = "Team X", clear the Epics Team field

Does this make sense, is it a good way to go about it, and if so, how would I create an automation rule to do this?

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 25, 2021

Hello @Kasper Sørensen 

You should be able  to set the Team field, as per this other community post.

https://community.atlassian.com/t5/Jira-Software-questions/Is-it-possible-to-edit-the-quot-Team-quot-field-through-Jira/qaq-p/1648833

I haven't worked out exactly how you would set up the conditional logic about when to set it and when to clear it.

Bill Sheboy
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.
June 25, 2021

Hi @Kasper Sørensen and @Trudy Claspill 

How about this:

  • use LookupIssues with JQL where the epic link is the target and team is "Team X"
  • When {{lookupIssues.size|0}} is greater than 0 set the epic's team to match
  • Otherwise, clear the epic's team

Best regards,

Bill

Like # people like this
Kasper Sørensen June 28, 2021

@Bill Sheboy Thank for your answer. Some new things for me here :-).

I hope you can help explain it in a bit more detail. I have come this far

  1. When: Value changes for Team field
  2. Then: Lookup issues {{lookupIssues.size|0}}

I'm uncertain if I should use an if statement, and if so, how I would do it.

Screenshot 2021-06-28 at 09.48.23.png

Bill Sheboy
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.
June 28, 2021

Hi, and sorry I was not more clear on the approach.  Please take a look at this documentation for Lookup Issues: https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/#Smartvaluesgeneral---lookupIssues--

This action uses JQL to gather a set of issues.  You wanted to find issues for an epic where the team is "Team-X", so the flow would be something like the following.  Please adjust based upon your actual fields, team name, etc.

  • trigger: when value changes for Team
  • condition: issue type is epic
  • action: lookup issues with JQL of: "epic link" = {{triggerIssue.key}} AND Team = "Team-X"
  • if/else condition, with advanced comparison: {{lookupIssues.size|0}} is greater than 0
    • action: edit to set the epic's Team to "Team-X"
  • else...
    • action: edit to clear the epic's Team
Kasper Sørensen July 1, 2021

@Bill Sheboy Thanks a lot for taking the time to help me out. I think there is something wrong in the logic. I can't really get it to work. I can get it to trigger correctly, I think, but I can get the result I'm after.

  • Should the first condition be "does not equal epic"? It helps a little bit, but still doesn't make the epic change based on the child issues.

I'm not sure about the rest, but something tells me it is off somehow. I can see the log, and it triggers but doesn't change the parent epics based on the issue change.

In another rule, I have identified that the Team field has ID 3. Below is what I have set up, and it doesn't really work as I want it to. Do you have any idea, what is wrong?

Screenshot 2021-07-01 at 17.28.05.png

Bill Sheboy
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.
July 6, 2021

Hi @Kasper Sørensen 

Sorry I wasn't clear...and thanks for catching my error! After you test the Lookup Issues and decide to update the epic, you will need a Branch to select the epic, and then you can edit it.

  • trigger: when value changes for Team
  • condition: issue type is not epic
  • action: lookup issues with JQL of: "epic link" = {{triggerIssue.key}} AND Team = "Team-X"
  • if/else condition, with advanced comparison: {{lookupIssues.size|0}} is greater than 0
    • branch on the trigger issue's epic
      • action: edit to set the epic's Team to "Team-X"
  • else...
    • branch on the trigger issue's epic
      • action: edit to clear the epic's Team

Suggest an answer

Log in or Sign up to answer