Hey there!
I currently have a custom field "Field A" of type labels. I have an automation which generates a subtask, then populates the description with the labels. This currently runs through
{{triggerIssue.Field A.join("\n")}}
I find the same result using
{{#triggerIssue.Field A}} {{.}} {{/}}
I've written the labels in the format "Table:column", referring to relational database tables and columns , e.g. "Events:score" or "Colour:value".
I want to display only those labels which start with "Events:" in my new subticket, but I haven't been able to get the if logic working at all. For instance, even the following prints nothing into the description
{{#triggerIssue.Field A}}
{{if(.)}} Hello!
{{else}}
Goodbye!
{{/}} {{/}}
What's the solution?
Hi @Jacob Stephenson -- Welcome to the Atlassian Community!
There are at least two ways to do this with automation rules...
Use the match() function with a regular expression to return the list of matching labels:
{{issue.labels.match("((Events|Colour):.++)")}}
Use the iterator (as you are trying) with text functions, and a variable. Some rule functions can work with an implied parameter within an iterator. In this case, we use startsWith() with the implied {{.}} as the source, and then later extract the matches back into a list.
{{#issue.labels}}{{#if(or(startsWith("Events:"),startsWith("Colour:")))}}{{.}}, {{/}}{{/}}
{{varFilteredLabels.substringBeforeLast(",").split(", ")}}
Kind regards,
Bill
Thanks Bill!!
I've attempted the top solution so far, which is more elegant and for which I thank you. Will check the other for my education.
Yours gratefully,
Jacob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn that helped!
Each approach has its benefits for searches / parsing, so they are good to keep in the toolkit:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.