Hi,
after a migration I have multiple Labels (all with prefixes). With these I want to make JQL and Reassign Assets.
So e.g. these labels:
firm-EDI-310474, firm-EDI-4747743, firm-EDI-660640, mess-EDI-282211, mess-EDI-282219, prot-AS2
I need a string from all labels with prefix "firm-" like
EDI-310474, EDI-4747743, EDI-660640
I tried everything with parsing through labels, conditions in any syntax possible But I didn't come to an end.
so some kind of
{{issue.labels.match("firm-.*").join(", ")}}
Any ideas?
Despite posts elsewhere lamenting that you can't iterate over the Labels field effectively, I think I can get you very close.
I started with an issue that had a bunch of labels:
Your prefix is "firm-" and my prefix is "M". Note that your prefix is 5 chrs long, mine is 1 chr long.
This smart value:
{{#issue.labels}}{{#if(startsWith("M"))}}{{substring(1)}}, {{/}}{{/}}
produces this text output:
For your situation you'll want to change the substring(1) call to substring(5) to skip all of your prefix, and of course change "M" to "firm-".
We can't use the {{^last}} trick in automation list iteration here (to omit the final comma) because the list of labels might very well contain labels after the last matching one. So don't bother.
If you really need to remove the trailing comma (and space), you can store this string in a variable and use the substring() and length() functions to remove the last two chrs.
As I don´t get the whole use case (where and how this flow should start, where to find the pattern,....) I just started how this could even be iterated with a "log action".
the follwing at least gave a filtered list of labels starting with "firm". Maybe this could be at list a starting point or hint how to go on:
{{#issue.labels}}{{#if(startsWith("firm"))}} {{.}} {{/}}{{/}}
Looking forward hearing from you.
Best
Stefan
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.