Whether it be an Epic and its children or a Task/Story and it's sub-tasks, we often have need to sum up the value of a number field to the parent. The question is, how do we iterate over all the children at one time, get the values and add them all up at the same time?
The Answer
The answer is an automation rule using the lookup issues functionality. If you haven't tried a rule using lookup, now is a great time to give it a try with the sample below.
Just for fun, let's throw a couple of things in the mix. Let's say you are hosting an event and charge admission. You set up a Jira Service Management project with a nice form to capture registrations. You have different ticket prices available for different levels of the event. Users select a level with a price/cost, complete the registration information and submit the request. The user either sees a link to make the payment or gets a separate email.
As a result, you spin off separate issues in a Business project for each registration so your team can process information without the expensive Agent licenses.
Now, before you get too excited, I am not showing you how to do all of that here! Might be a subject for a future article though. :-)
The Event
Though typically very humble, we were able to talk @Jack Brickey into doing an autograph session. We setup 3 tiers of access - Standard (autograph and picture with Jack - $50) Gold (Standard plus a group cocktail hour with Jack - $75), and VIP (Gold plus dinner with Jack - $100).
Here's the parameters though - the event space only holds 120 people before the Fire Marshall shuts it down. And Jack's humble fee to just to get him in the door is $5,000. So, we need to make at least that much in revenue and not go over the limit because of a bunch of cheap Standard tickets.
The Rule
With the registrations rolling in, you need to check for capacity and whether we have sold enough tickets for the total revenue to hit at least our breakeven point. So, time for a report. We need two things - the number of tickets sold, and the total value of all of the tickets sold.
We quickly setup a simple automation rule using lookup issues. I used a Scheduled trigger so I could run the rule immediately and set it up to run early each morning with the latest results.
I created an Epic for the event and as issues (Orders) were created, they were linked as children of the Epic. It's the only Epic I had for now, otherwise, I would need more Conditions to differentiate between them.
Then I added an action for Lookup Issues. Here you can see the query that was used to get the issues I wanted.
Finally, I add an action for Edit issue - in this case it will edit the Issue in my Condition - the Epic, which is where my totals will reside.
I have selected the Total Attendees custom number field to get a count of the Orders, and the Total Revenue custom number field to get the total dollar amount in tickets sold so far.
The Results
So, how are we doing? I also created a simple dashboard with a couple of gadgets to check on the total ticket count and see those broken down by Ticket Level as well as see current Revenue.
Hurray! We are under the 120 person limit, and topped our Revenue goal. Jack gets paid, and we have enough money to pay the venue.
Maybe YOU will be lucky enough to attend Autograph Session #2 - maybe at Team '25??
Regardless, you are already a winner as you can now use Lookup Issues to sum up child issues. Let us know in the comments below what you like to use Lookup Issues for in your automation rules.
John Funk
Jira Systems Administrator
ProVision Systems
Dubai, UAE
3,173 accepted answers
5 comments