Forums

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

Create a automation to copy labels from another issue

Devashish Kedar August 8, 2024



image.pngimage.pngimage.png

 

I’m working with two sets of data, Story 1 and Story 2. In Story 1, I have an array that contains around 6 to 7 labels. My task is to fetch these labels and then append them to Story 2. If I run into any issues, like errors or unexpected outcomes, I’ll need to provide more details to get help with resolving them.

 

 

2 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 8, 2024

Hi @Devashish Kedar -- Welcome to the Atlassian Community!

Rather than branching to add the labels, I recommend using list iteration to add all of them in on edit issue action with advanced edit with a JSON, update.

For example:

  • trigger: manual, to get your sourceIssue
  • action: lookup issues with JQL of key = {{userInputs.sourceIssue}}
  • smart value condition:
    • first value: {{lookupIssues.first.labels.size}}
    • condition: greater than
    • second value: 0
  • edit issue: using advanced edit with JSON
{
"update": {
"labels": [
{{#lookupIssues.first.labels}}
{ "add": "{{.}}" }{{^last}}, {{/}}
{{/}}
]
}
}

 

Kind regards,
Bill

0 votes
Rudy Holtkamp
Community Champion
August 8, 2024

Hi @Devashish Kedar & welcome to the community,

In your rule I don't see where you make a distinction between story 1 and story 2. I assume that the key of story 1 is entered when you run the automation rule, but what about story 2?

If the are linked, then you should create a brand 'related issues' and make sure that Story 2 is selected there. Within that branch you can use an edit issue and select 'labels' as field. 
Then you can use the ... menu and choose copy. Then click on 'Copy labels from current issue'. Select trigger issue and check 'add to existing values'. (see image below).

image.png

Now the Story 1 labels are added to Story 2

Devashish Kedar August 8, 2024

I’m setting up a Jira automation where I have two issues, Story 1 and Story 2. Story 1, identified as ABC-1, has the labels ‘aa’ and ‘bb’. Story 2, identified as ABC-2, has the label ‘cc’.

The automation is designed to run on Story 2. When I initiate the automation on ABC-2, it asks for user input, which in this scenario is the issue key of Story 1 (ABC-1). After the user inputs this key, the automation should fetch the labels from ABC-1 and append them to ABC-2. As a result, the labels for ABC-2 should be updated to include ‘cc’, ‘aa’, and ‘bb’.

where ABC-1 and ABC-2 are not linked

Suggest an answer

Log in or Sign up to answer