Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

In an Automation, how to populate a label field with a list at the time of issue creation?

Gevorg Hovakimyan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 21, 2024

I need an automation to create an issue. In that issue that it creates, I need the automation to populate the label field. The contents of the label field need to come from a comma delimited text field, I'm having difficulty implementing this.

Here are the steps I've taken so far:

  1. Create the text variable with the contents (this is an input from the user): {{myValiable}} = "a,b,c"
  2. In the issue creation automation, I select the "Label" field and write the following smart values: {{myVariable.split(",").distinct}}

example.PNG

When I run this, even though I don't have spaces, I get an error saying that the label cannot contain spaces:

Capture.PNG

Some other things that I've attempted are to try to change the smart value expression to the following:

  • {{myVariable.split(",").distinct.trim()}}
  • {{myVariable.split(",")}}

Additionally, I've attempted to add the labels after creation by creating the issue and sending the key of the created issue and each individual label (though advanced branching) through a websocket, then through a different automation adding the labels in. But the problem with this method is that it creates a race condition and not all labels get added because they override one another...

1 answer

1 accepted

0 votes
Answer accepted
Gevorg Hovakimyan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 27, 2024

I figured it out... You have to do the splitting in the "additional fields" (JSON area). You need to split the text then convert it to a JSON array:

{
"fields": {
"Labels": {{userInputs.label.split(",").asJsonStringArray}}
}
}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events