Hello,
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!
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,
Bill
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!
Best,
Jeanine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
Using remove() is better for your use case as it can handle the application name being in the middle of the results.
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.
Thank you @Bill Sheboy this fixed my issue
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.