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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,702
Community Members
 
Community Events
184
Community Groups

Jira Automation using smart values and text fields - count mentions of a word?

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?

1 answer

1 accepted

0 votes
Answer accepted
Manon Soubies-Camy _Modus Create_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 27, 2023

Hi @Michael Couillard,

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!

Amazing - it worked! I only had to change from "field name" to the underlying id, like "customfield_123".

Thank you!

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

Hi @Michael Couillard 

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:

  • first split the field by line breaks,
  • join back together with a space as a delimiter, and 
  • finally split again by any spaces found.

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events