Jira Automation smart value list for Parent items in Sprint

Andy Tran January 18, 2024

Problem: I've tried several different variations and cannot get the Parent Summary to show up.  I can get list of issues to appear but not the associated Parents.  

What I'm doing: I've created an automation using MS Teams incoming webhook where I post a message in a designated Teams channel when a Sprint starts in Jira. 

The only problem I'm having is trying to get this list of Epics (Parents) Summary to show up in the post.  

As you can see I've tried:
{{#issue.epic}}
* {{issue.parent.summary}}
{{/}}

 

I've also tried just {{issue.parent}} instead of e2024-01-18_15-16-46.pngpic as well as other iterations but cannot seem to get it to show up.  Not sure if it's even possible.  

Forgive me, I'm relatively new to this whole automation setup.

2 answers

1 accepted

0 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.
January 18, 2024

Hi @Andy Tran 

You state you are trying to list the parent's summaries (that is, the associated epics for any issues in the sprint which started).

My assumption is only the child issues, and not the Epics, are assigned to the Sprint.

 

Your rule has a few challenges, and so my suggestions would be:

  • The rule trigger is Sprint Started, but your Lookup Issues action uses JQL referencing openSprints().  I recommend changing that JQL to specifically reference the sprint which triggered the rule:
    • project = yourProjectName AND sprint = {{sprint.id}}
  • The lookup contains the issues in the sprint in the smart value {{lookupIssues}} and that may contain multiple issues (e.g., Story or Task) for each parent epic.  To narrow down the list and have each epic listed once, a second Lookup Issues action is needed, referencing the first, and adding the distinct function.  Perhaps like below.  Please adjust this to handle the cases where there are no issues found in the sprint, as this rule just halts processing.
    • trigger: sprint started
    • action: lookup issues to get the issues in the sprint
    • smart value condition: to check if any issues were found
      • first value: {{lookupIssues.size|0}}
      • condition: greater than
      • second value: 0
    • action: lookup issues to get just the epics, with JQL of
      • key IN ( {{lookupIssues.parent.key.distinct}} ) AND issueType = Epic
    • now the lookup contains the epics, for displaying in your message
    • action: send the message

 

One would think that this would work with the first lookup to get the summaries:

{{lookupIssues.parent.summary.distinct}}

However it appears (surprisingly) that when an issue does not have a parent epic, the "parent" smart value returns the original issue instead of null!

 

Kind regards,
Bill

Andy Tran January 24, 2024

Hi @Bill Sheboy ,

Thanks for this!  It helped a lot however, looks like it was returning the summaries of the issuetype = Saga, which is the parent of the Epics rather than Epics.  I just removed the parent from {{lookupIssues.parent.summary.distinct}} and it works just great.

 

Thanks again!

Andy Tran January 24, 2024

@Bill Sheboy would you know how to get the return values into a bullet list?  I've been trying everything and cannot figure out how to use smart values to get each summary into a bullet list.  

{{lookupIssues.summary.distinct}}

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.
January 24, 2024

What is the markup used to make a bullet item for the Teams message?

Let's assume it is an asterisk * for now, and so the bullet list would be this:

{{#lookupIssues.summary.distinct}}
* {{.}}
{{/}}

How this works:

  • the distinct function on the lookup issues, summary fields produces a list
  • we use an iterator with the # sign to walk the list
  • each item in the list is returned with {{.}}
  • finally we prefix each one with an asterisk
Andy Tran January 25, 2024

I didn't think to use {{.}} 

Works Great! Thanks again Bill! Much appreciated

Like Bill Sheboy likes this
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.
January 25, 2024

Awesome; I am glad to learn that helped!

And...please take a look at the combined-examples for list functions.  They show some features for list handling not noted anywhere else in the documentation.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#Combined-function-examples

0 votes
Harsh
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.
January 18, 2024

Hi @Andy Tran 

Can you try using only {{sourceIssue.summary}} in this case source issue is the parent. Hope this helps. 

Thanks 

Suggest an answer

Log in or Sign up to answer