Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Use Jira automation to calculate story points based on labels

Scott Franz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Oct 30, 2023

I am trying to use Jira Automation to assign a story point value based on labels.  For example, label A = story point value 1, label B = 2 points, C = 3, and so on. I have about 15 labels and there can be any combination of them on a given issue.  I want the story points to be the cumulative value. 

My trigger is when the label field changes.  What I'd like to do is just reset it to zero and then add to it for every label I find.  I tried using if statements, but I only ever get the first value added, never cumulative. I tried zeroing out the story points first, but that doesn't seem to apply either.  It's not an if\else scenario, it's multiple if statements.

I'm missing something in getting this value passed from one if statement to the next in my automation. Any thoughts on how to accomplish this would be much appreciated. 

1 answer

3 votes
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.
Oct 30, 2023

Hi @Scott Franz -- Welcome to the Atlassian Community!

I am curious about your scenario: why not just set the story points rather than adding from labels?  I find it unlikely this is to implement some type of "voting" or "planning poker", as the label could only have a value once, correct?

Until we know that...

The format of your labels will determine how you do this.  The key will be extracting the values so they can be added as numbers.  Perhaps using the smart value text functions, like match() with a regular expression: https://confluence.atlassian.com/automation/jira-smart-values-text-fields-993924863.html

And once you have a way to convert them into numbers, they can be iterated as a list: https://confluence.atlassian.com/automation/jira-smart-values-lists-993924868.html

And finally summed using a math expression: https://confluence.atlassian.com/automation/jira-smart-values-math-expressions-993924866.html

Let's assume they only contain numbers.  (You may use the text functions to figure out the extraction part.)  The labels can be iterated over to be summed like this:

{{#=}} 0 {{#issue.labels}} + {{.}} {{/}}{{/}}

This works by iterating each label value, and adding it, preceded by a plus sign.  With a leading zero to make valid math expression, this can be summed up.

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer