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
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
We have a field for "testing notes". Inside that field we sometimes list bugs with a static prefix for each. I'd like an automation to count the number of "bug" mentions and save that to another ticket field. This will power reporting to count bugs per ticket, which we can then summarize by project or dev.
There are a good number of text functions today, but none can find/match/count multiple key words inside a single text field: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/
Is there an alternative?
Have you considered linking bug tickets instead of listing them manually?
To answer your initial question, here is how you can count the number of "bug" mentions in a custom field:
{{issue.Testing Notes.toLowerCase().match(".*(bug).*").size}}
I added the toLowerCase() function to count Bug, bug, BUG, etc.
Hope this helps!
- Manon
Good point - for this scenario we're talking inside the context of 1 ticket. So during the initial dev/test process of 1 ticket, it can accumulate a number of bugs that get resolved immediately by the dev.
So when the ticket is fully tested, there might be a handful of bugs reported - but now all are resolved.
We'd like to count that 'internal' number of bugs. Not the new bugs that are forked into brand-new tickets (and handled later).
As for match and size - that's a great option! I didn't see it available in documentation, but will give it a shot!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Amazing - it worked! I only had to change from "field name" to the underlying id, like "customfield_123".
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, and...to the answer provided:
Do you ever expect multiple "bug" references in a single text line of the field? If so, consider first splitting up the field as the match() function can only find the first entry per text line. For example:
{{issue.Testing Notes.toLowerCase().split("\n").join(" ").split(" ").match(".*(bug).*").size|0}}
What this does is:
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.