Parent of a Parent Jira Automation

Jeffrey Crime February 21, 2024

My goal is to be able to subtract Story points from an Initiative when a new story/task is pointed underneath the Initiative and Epic.  

Some background: My org uses the "Parent" field to in stories to identify the parent epic.  And Epics also use the same "Parent" field to identify the parent Initiative.  

The hierarchy I am working with is

1. Initiative

2. Epic

3. Story/Task 

I am essentially trying to use automation to subtract "Planned Story points" from the Initiative when a new story has "Story points" added to it.  And I am trying to accomplish this without touching the parent epic.

I have tried a few different methods including below. Branch to the parent seems to affect the Epic and not the Initiative.  Would anyone know the JQL I can use to essential branch to the Parent of a Parent?

Screenshot 2024-02-21 131845.jpg

 

1 answer

1 accepted

2 votes
Answer accepted
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.
February 21, 2024

Hi @Jeffrey Crime -- Welcome to the Atlassian Community!

To do what you ask, you will want to change the branch to use JQL to get to the parent of the parent (i.e., the Initiative).  I am not using the Premium license level, so let's test some things first...

  • Write a test rule, with a manual trigger, and write this to the audit log:
    • {{issue.parent.parent.key}}
  • Run that rule from a story which has an epic parent, with an Initiative parent of the Epic

I expect that not to work, but I will be pleasantly surprised if it does provide the Initiative key.

Why that might not work...

When an automation rule references the other issues linked to the current issue (e.g., the parent) only some of the linked issue's fields are available.  If it did not do that, you could imagine that a single issue could yank in tons of data, though subtasks, issue links, etc.

If it works, you are set and can use that with a JQL branch (instead of branch to parent) to update the Initiative.

 

Assuming that did not work...We need the epic's parent, so after your condition test on the issue type, let's add more actions (shown in italics below):

  • ...
  • condition: issue type is Spike, Bug, Task, or Story
  • action: lookup issues to get the epic, with key = {{triggerIssue.parent.key}}
  • action: create variable
    • name: varInitiativeKey
    • smart value: {{lookupIssues.first.parent.key}}
  • action: lookup issues to get the siblings of the trigger issue, which have the same parent
  • branch: on JQL (instead of parent), with key = {{varInitiativeKey}}
    • action: edit issue, using the data from your second lookup (as needed)
    • ...

Kind regards,
Bill

Jeffrey Crime February 23, 2024

Hi!  Thanks for the quick response!  I tried going with your first suggestion with the test rule using the JQL - {{issue.parent.parent.key}} to reference the Initiative from the triggered story.  No luck.

As far as your second suggestion, I input the suggested logic into the automation, however I am getting following issues when trying to execute:

Lookup Issues

There was an error executing a search during custom value definition: .

Custom Smart Value JQL Search: "(Jira-1) AND (project in (10199))" - Error in the JQL Query: Expecting operator but got ')'. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'. (line 1, character 11)

Branch Rule/ Related Issues

Error searching for related issues. This is most likely because the following issues don't have a related issue of the type you specified. Try narrowing your search to only include issues that contain links to related issues:

Jira-2: "((key = ) AND (key != Jira-2)) AND (project in (10199))" - Error in JQL Query: Expecting either a value, list or function but got ')'. You must surround ')' in quotation marks to use it as a value. (line 1, character 9)

Could it be the way I am branching into the Parent key perhaps?  

Thanks!

Screenshot 2024-02-23 144228.jpg

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.
February 23, 2024

I see a typo where the name of your created variable does not match the name of the one used in the branch.

Also, the JQL for the branch should be:

key = {{varInitiativeKey}}

And not just the variable.

 

Would you please show the details of your create variable action to confirm this?  Thanks!

Jeffrey Crime February 26, 2024

Thanks for the point out!  Fixed any typos I saw.  Perhaps it could be the Smart value I am inputting?  

New to Jira automation so i'm interested in how it works.  Thank you!

Screenshot 2024-02-26 143513.jpg

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.
February 26, 2024

If that is still not working, would you pleases post an image of the audit log details showing the rule executing?

Jeffrey Crime February 27, 2024

Sure.  I posted the audit log as well as the full automation sequence.  Thanks

Screenshot 2024-02-27 132025.jpg

Screenshot 2024-02-27 131804.jpg

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.
February 27, 2024

The lookup issues action in the third step of your rule has invalid JQL.  That should be:

key = {{triggerIssue.parent.key}}

 

Jeffrey Crime February 27, 2024

It is Working now!  Thanks so much for your patients and help!  

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events