Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automations - From Comments Create Labels - Multiple Regex Matches Edited

Hi!  

Our automation is looking at the comments to see if there is anything like ##TESTING123 and making that into a label (I have a regex match for ##).  I strip off the ## and create a label called "TESTING123".  Works good.

 

The issue i have is when there is more than one regex match (ie someone enters a comment like this "Here is a comment that contains ##TESTING123 and ##TESTING124").  I'm trying to use a smart value that contains all matches and then I want to iterate them and put them in to the issue JSON label group as such:

{
   "fields": {
       "labels": [
          "{{labelNames}}"
        ],
     }
}

My smart label name is labelNames - which, according to the logs, looks like this:  TESTING123, TESTING124

Unfortunately, this doesn't work.  I think it's because there needs to be double quotes around each value when iterating and a comma after each iteration except the last one for it to be proper JSON.  


Can anyone help me out?

1 answer

1 accepted

0 votes
Answer accepted
Eric Atlassian Team Apr 06, 2021

Hi @Ryan Markle 

 

To achieve the behaviour you want, you would need to iterate (branch) over the smart value.

Unfortunately, this is not currently supported. There's an open feature request for this: https://codebarrel.atlassian.net/browse/AUT-2023.

 

Eric

For future reference, I was able to add(not update) multiple labels using the following json:

{
  "fields": {
      "labels": {{issue.summary.match("##(\w+)\b").asJsonStringArray}}
   }  
}

For some reason it didn't like me using a variable I created so I had to use the field directly

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you