You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.