Forums

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

How to combine values from various multiple-select fields into the same field on a linked work item

Sara Beyer
Community Champion
April 17, 2025
Is it possible to have two multiple-select fields be "combined" into another ticket?
Use case:
  • ABC-1 has Favorite Color field = Red, Blue, Green
  • ABC-2 has Favorite Color field = Green, White
  • ABC-3 "is blocked by" ABC-1 and ABC-2

 

I want ABC-3 to have Favorite Color = Red, Blue, Green, White

 

Currently I'm using this automation, but it doesn't always pull in all the values as it should and I know it's not complete - and that's where I'm stuck.

  1. When value changes for Favorite Color
  2. Issue Type = X
    1. BRANCH
    2. For linked issues Types: Blocks
    3. Then: Edit issue fields: Favorite Color
      1. Add Favorite color from trigger issue

2 answers

2 votes
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.
April 17, 2025

Hi @Sara Beyer 

Using a branch will probably not work for this scenario: branches which could be on more than one thing are run in parallel and asynchronously.  The impact for your rule is the multiple updates could collide, intermittently succeeding or failing.

 

A better approach is to perform one single update of the work item...

Use the Lookup Issues action to first gather all of the "source" issues from which you want to merge the values.  Then update using a JSON expression to add the values need.

Let's assume you want to ADD the values, not replace the ones in your ABC-3 work item.  And so the rule could be:

  • trigger: field value changes for Favorite Color
  • action: lookup issues, with JQL to find any work items with the "blocks" links
    • issue IN linkedIssues({{triggerIssue.key}}, "blocks")
  • smart values condition:   check if any linked work items were found
    • first value: {{lookupIssues.size}}
    • condition: greater than
    • second value: 0
  • smart values condition:   check if there are any values to add; use your custom field ID
    • first value: {{lookupIssues.customField_12345.value.flatten.distinct}}
    • condition: does not equal
    • second value: leave as empty
  • action: edit work item
    • use a JSON expression rather than selecting the field from the dropdown list
{
"update": {
"customfield_12345": [
{{#lookupIssues.customField_12345.value.flatten.distinct}}
{
"add": { "value": "{{.}}" }
} {{^last}},{{/}}
{{/}}
]
}
}

 

Please note well: this rule assumes the trigger issue is the one you want to update.  Additional logic to check the link types is needed when you want to handle any updates, such as finding and branching to your ABC-3 work item.

 

Kind regards,
Bill

0 votes
Darryl Lee
Community Champion
April 17, 2025

Hi @Sara Beyer -

Unfortunately I think it's because Automation runs branches in parallel. So it tries to "add" the Favorite Colors from tickets ABC-1 and ABC-2 at the same time, and that leads to unpredictable results.

Does that sound about right, @Bill Sheboy ?

Darryl Lee
Community Champion
April 17, 2025

Oh, but you probably want a FIX, not just why your rule doesn't work.

Maybe do a Lookup for Linked Issues of Type Block, and THEN you can set ABC-3's Favorite Color to be:

{{lookupIssues."Favorite Color"}}

Or maybe

{{lookupIssues."Favorite Color".join(",")}}

I'd play with that.

Darryl Lee
Community Champion
April 17, 2025

Or you know, just use @Bill Sheboy 's answer up above. Very complete. Nice work Bill!

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.
April 17, 2025

Hey, @Darryl Lee -- I must have been typing that up whilst you were mentioning me :^)

 

Darryl Lee
Community Champion
April 17, 2025

Woof. I've been on the Internet for way too long and forget that it really doesn't matter if I get "FIRST!" here.

Suggest an answer

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

Atlassian Community Events