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
Community Members
Community Events
Community Groups

Jira Automation - Smart Value to Extract Label from Issue


I am working with jira automation and smart values and am running into a blocker when trying to extract just one label (out of 2-3) from an issue. I would like to extract an application name from a label such as "app_AppXYZ" and was successful in doing so using the following: {{issue.labels.substringAfter("app_")}}

However, the issues will have 2-3 other labels and the end result comes out as "AppXYZ,,," (the 3 commas being the other labels).

I tried to use {{issue.labels.substringBetween("app_","the_other_label")}} as well as {{issue.labels.substringBetween("app_",",")}} but neither were successful. 

Any suggestions or help would be so appreciated! Thank you!

1 answer

1 accepted

0 votes
Answer accepted

Hi @jeanine -- Welcome to the Atlassian Community!

As you note, the labels smart value is a list, so you can merge everything together, and then parse, or filter first.  Two of the ways to solve this are:

Kind regards,

Hi @Bill Sheboy 

Thank you for the quick answer!

For option one, I attempted to combine two smart values into one such as {{issue.labels.substringAfter("app_").substringBefore(",")}} but it seems it did not honor the second statement and the commas were still returned. Would you be able to provide more context as to how to use two smart values in one statement? 

Or perhaps you can help me understand where to store the first value (app name,,,) so that I may use the second smart value on it and extract only the name.

I appreciate your help!




Sorry I wasn't more clear...Your first parsing of Labels is still going to produce a list result, and so that needs to become text (a string) before using substringBefore() or maybe remove()

Perhaps like this:

  • Create a variable, storing the result of your first parsing on "app_".  Let's call it varApps
  • That variable is now text, and you can remove the stray commas with {{varApps.remove(",")}}

Using remove() is better for your use case as it can handle the application name being in the middle of the results.

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events