Smart Value to display the sum of child issues linked to an epic

carolina March 27, 2023

Hello,

I'm trying to display the total number of child issues linked to an epic on a custom field in the Epic.

I created an automation that would auto-populate a custom field called "number of child issues linked", but I can't get it to calculate the total sum of this count. 

Here's my rule:

Screenshot 2023-03-27 at 11.49.44.png

I believe the issue is with the Smart Value I'm using {{issue.size}}, it's not counting the total number, it's just displaying the number "1" when I make an update to any child task issues. For eg: I have 4 tasks that are child issues to an epic, I update all the tasks to my automation runs, and my custom field in the Epic (number of child issues linked) displays there is only 1 child issue linked.

I've also tried the {{lookupIssues.size}} smart value and it always returns 0. 

Any ideas of what could work?

 

1 answer

1 accepted

0 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.
March 27, 2023

Hello @carolina 

{{lookupIssues.size}} should give you the number of issues returned by the JQL in the Lookup Issue action. 

You can use the Log action to print messages and smart values into the rule's Audit Log to help with debugging the rule.

Can you change the Edit action to use {{lookupIssues.size}}, and some Log actions to print out each smart value, then take an action again to trigger the rule? After that share with us the Audit Log details for that execution of the rule.

It would also be helpful if you can show us the parent Epic details to show us the Child Issues section to affirm how many child issues exist in the Epic.

 

Lastly, why have you opted to use the Issue Updated trigger? That will cause the rule to be triggered for every type of update for the issue. Do you really want it triggered that frequently?

carolina March 28, 2023

Hi @Trudy Claspill thank you for your reply! I changed the Edit action to use {{lookupIssues.size}}. 

I've been doing some research on the Log Action, but I can't figure out what I need to write as the log message :/ I'm new to the game. Do you have any tips?

Here's what the Epic looks like:

Screenshot 2023-03-28 at 09.22.27.png

You can see that to the right I have a field to display the number of child issues, which should be 2, but it's 0.

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.
March 28, 2023

For Log Action you can put in plain text and/or smart values. So, for instance, after the Lookup Issues action you could use a Log action to print out the size of the results set:

Lookup Issues returned this many issues: {{lookupIssues.size}}

You can use the Log action to print out any smart value to check that the value contains what you expect.

 

Can you show us the output of the Audit Log for the rule when it executes? Click on Audit Log above the rule steps. That will show you the logs for each configuration change and execution of the rule. You can click on the Show more to the right of an entry to get more details.

 

Looking at the rule details you provided and the image of the Epic with child issues I see a problem. In the Epic it looks like the child issues might all be Bugs based on their icon. In the rule you have a condition to check that the issue that triggered the rule (the issue that was changed) is a Task. As this Epic doesn't appear to have any Task child issues, the rule will not update this Epic.

carolina March 29, 2023

Hi Trudy,

Thank you so much for your reply! Your comment is correct, I sent you a picture of only bugs when the rule was meant for tasks by mistake.

The audit log came back as zero again :/ and ticket 124 has 5 child tickets linked.

Screenshot 2023-03-29 at 08.57.19.pngScreenshot 2023-03-29 at 08.58.14.png

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.
March 29, 2023

Make liberal use of the Log Action to print out to the rule execution audit log any smart values that you are trying to use in your rule to make sure they have the values you expect.

After starting the branch For Epic and before the action to Lookup Issues, add a Log action and print out the smart value {{issue}}. You are trying to use that in your Lookup Issue JQL. Make sure that it has the value you expect.

I think you action need to be using {{issue.key}} there instead.

carolina March 30, 2023

@tru thank you for the advice, I was able to add a Log Action where you said and it's returning the value as expected, but the rule still says that the {{lookupIssues.size}} is zero... this is so frustrating :( I don't get why it's not working... 

Screenshot 2023-03-30 at 09.03.18.png

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.
March 30, 2023

You should use the singular, not plural, issue

Use {{issue.key}} not {issues.key}}

If you go to the Advanced Issue Search screen and enter the JQL that you use in the Lookup, substituting the actual Epic issue key for the smart value, do you get a set of child issues?

Are these issues in a Company Managed project or a Team Managed project? That information will display at the bottom of the navigation panel on the left when you view the project.

The Epic Link field is used only in Company Managed projects. If these issues are in a Team Managed project then you need to use the Parent field instead

Parent = {{issue.key}}

carolina March 31, 2023

Hi Trudy, we've made progress!!

By switching the {{issue.key}} to {issues.key}} the audit log will now return the real values!! However... I've tried testing multiple times and the automation still prints "0" in the "number of child issues linked" field. 

Screenshot 2023-03-31 at 09.46.42.png

 

See below #124 that should have 6 child issues:

Screenshot 2023-03-31 at 09.48.55.png

I feel that we are getting so close! Thank you for your help so far, just need to figure out why the field is still showing zero when I have this...:

Screenshot 2023-03-31 at 09.50.21.png

Additionally, this is a team-managed project and I've also tried changing the "For Parent" branch, but the automation doesn't work, it says the issues don't match the condition and no actions are performed.

carolina March 31, 2023

Dear Trudy, 

I finally got it to work!!!

I had to change the "Issue Type does not equal to Epic" to "Issue Type equals to Task" and copy past the rule for all my other issue types, i.e. I had to create 6 different rules, each with different "issue types equals" condition.

AND NOW IT WORKS!! Thank you super much for all your help!

Screenshot 2023-03-31 at 11.58.05.png

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.
March 31, 2023

With the condition being

Issue Type is not equal to Epic

...your rule may have been getting triggered by a transition for a Subtask. That would explain the problem with the issue count from LookUp issues.

If so you can still use just one rule and include all the child issue types in your condition like this

Screen Shot 2023-03-31 at 9.41.21 AM.png

 

Or set the condition to exclude Epics and Subtasks like this

Screen Shot 2023-03-31 at 9.45.21 AM.png

Like Josh Kronick likes this
carolina March 31, 2023

Hi Trudy, I did try that but it didn't work. Ultimately the only thing that did work was splitting all the issue types :/ 

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.
March 31, 2023

There's no reason that should not work. If you want to explore that more, please show the rule that uses that method and the full Audit Log for an execution of that rule.

If you don't want to spend any more time on it, that is fine too. :)

CC July 10, 2023

@Trudy Claspill If I can pick up the thread.  I followed all the steps above.

I couldn't get the numbers to update in the custom field.  Well I figured it out.  The "I" in lookupIssue has to be capitalized.  Grrr and woo hoo.

CC July 10, 2023

@Trudy Claspill Another question, I would like the values to update whenever an issue is removed or added from the epic.  I see link added and link deleted triggers which doesn't see to include child issues.  I tested deleting a story and the numbers did not update.  Only when I add a story does the data update.

Also, i need to update our current epics with data.  Any thoughts on how to do update a bunch of epics without breaking the system.

PS Company managed and in the cloud.

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.
July 10, 2023

Hello @CC 

Since your questions are going beyond the bounds of the original post, which also already has an accepted answer, please start a new post for your additional questions.

I recommend that you include a link to this post to show the material you referenced in your efforts.

Also, please post a complete copy of your current automation rule(s) in your new post.

Like # people like this
Josh Kronick February 12, 2024

Hi @CC -- you should just try changing the trigger to update the # of child issue fields whenever the PARENT field is updated. that should add or remove any issues to the # of child issues any time you update the PARENT field and use the jql:

issuetype in (standardIssueTypes()) AND issuetype NOT IN (Epic)

 

That should update the field any time an issue is added or removed from an epic.

Suggest an answer

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

Atlassian Community Events