Retrieving and using grandparent epic in automation rules.

Angie Adams
Contributor
September 12, 2024

I am working on an automation to create a task from a sub-task.  The tricky part is that I want the grand-parent of the sub-task to the be parent of the new task I am creating.  I'm not sure how to retrieve the grandparent task to use it in an automation rule.  Is this possible?  and if so, how?

1 answer

1 accepted

2 votes
Answer accepted
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.
September 12, 2024

Hello @Angie Adams 

You should be able to use

{{triggerIssue.parent.parent.key}} 

to get the key for the "grandparent" issue assuming that the subtask is the rule trigger issue.

You could use that smart value to set the Parent field for the me issue you create. You may want to add a Log action in your rule to print the value into the log so that you can confirm the rule got the value you expect. You may also want to add a Condition to check that it actual has a value before you try to use it in your new issue.

Angie Adams
Contributor
September 13, 2024

Thanks, @Trudy Claspill the value was actually logged, but the generating the task caused an error creating the issue "Could not find issue by ID or Key. (parent)

Angie Adams
Contributor
September 13, 2024

@Trudy Claspill I did some more testing & found that {{issue.parent.parent.key}} worked.  Thanks for pointing me in the right direction.  I haven't figured out the rhyme or reason for why triggerIssue works in same cases and in others it has to be issue.  

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.
September 13, 2024

Hi @Angie Adams 

The reason for that difference is the {{triggerIssue}} always refers to the trigger issue and {{issue}} is relative to the location in the rule flow.

For an example, please consider this sample rule...

  • trigger: some trigger with an issue  ==> At this point, both {{triggerIssue}} and {{issue}} refer to the same thing.
  • action: some action
  • branch: on JQL to other issues
    • action: another action  ==> Inside the branch, {{triggerIssue}} and {{issue}} are different, where {{issue}} is now the branched-to issue(s).
  • action: an action after the branch  ==> After the branch, both {{triggerIssue}} and {{issue}} again refer to the same thing.

 

For these reasons, it is helpful to post images of your complete automation rule and the audit log details with a question.  They provide context to help the community offer better suggestions.

 

Kind regards,
Bill

Like Trudy Claspill likes this
Angie Adams
Contributor
September 13, 2024

@Bill Sheboy   I appreciate the explanation.  Automation is relatively new to me with majority being manual triggers to create a new issue.   In this example, trigger issue in main branch produced the same result as issue in the IF/else branch, but trigger issues was not found - with the action: create new issue.  I'm sure it will eventually click - especially with the help of your explanation.  It just hasn't yet.  the issue.parent.parent.key / triggerIssue.parent.parent.key was what I was really after as i couldn't find that in the documentation anywhere.  Appreciate the added info!

 

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