Automation to assign existing labels to issue based on Summary text

Molly
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!
February 3, 2025

 

Hello, I have created an automation that assigns existing labels to issues during a status transition. I am using {{issue.summary}} comparing the Summary with a regular expression like below for each label using if/then through the list of target labels. The list of labels is quite long and is expected to grow. Is there a more efficient way to accomplish this besides a series of if/then statement?

To summarize, I would like an automation that parses the Summary text and assigns existing labels based on this text that does not stop when a condition is met, thus assigning all applicable labels to the issue.

Thanks in advance

 

(?i)(gratuity|gratuities|grat)Screen Shot 2025-02-03 at 7.26.16 AM.png

 

2 answers

1 vote
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.
February 3, 2025

Hi @Molly -- Welcome to the Atlassian Community!

First thing, bulk, text-pattern replacement in automation rules can be challenging, primarily due to the possibility of collisions during issue updates.

Next, please use caution with regular expressions and automation rules.  There is no documentation on what is (or is not) supported in the syntax: it only states, with emphasis added by me: "underlying implementation is based on Java's Pattern class".  There are many community posts showing expressions which work in other parsers do not work in rules.  For that reason, I recommend not using syntax such as (?i) for case-insensitive, and instead force the Summary to a known case for the matching, such as with toLowerCase().

 

Let's check some things for your scenario to help identify possible solution approaches:

You describe "list of labels is quite long and is expected to grow."  How long is the list?  Rules are limited to 65 components (i.e., steps) and so some approaches would not work if you expect many values.

For example, a single chain of match() calls could be used to build a single create variable, with one issue update, although that would be difficult to maintain / update.  But if there are more than around 25 values, the rule may not be able to do all the label adds in one rule using single-value checks / updates, as you have tried.  Another approach could be using a lookup table of values and an advanced branch to iterate over them to search and then conditionally add the labels; that would be limited to 100 values.

 

For the examples you show, there is a root pattern which could be used for matching:

  • "print" is part of all three: print, printing, and printer
  • same for "grat" and its search values

Does this root pattern approach apply for all the values?

 

What do the translation of text to values look like?  That is, what label is added for "print" or for "grat"?  Is the same value or is it something else, such as "hardcopy" and "tip" for those.

 

How often do you expect the values to change and who will update them?

 

Kind regards,
Bill

0 votes
Duc Thang TRAN
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.
February 3, 2025

Hello @Molly 

You can use this doc with all regex smart value text 

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/

 

Or i can suggest using condition with jql exact match 

https://community.atlassian.com/t5/Jira-articles/Search-for-an-exact-phrase-with-JQL/ba-p/2131545

Hope this can help

 

Suggest an answer

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

Atlassian Community Events