Original Question:
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.
- When value changes for Favorite Color
- Issue Type = X
- BRANCH
- For linked issues Types: Blocks
- Then: Edit issue fields: Favorite Color
- Add Favorite color from trigger issue
UPDATE with answer:
This automation worked for me. Essentially, trigger is when value changes for Favorite Color on the linked issues (in my case they are Tasks - ABC-1 or ABC-2). Then, find the linked ticket (ABC-3) which I'm calling parent in this automation. Compare the values - make sure you get at least one parent in this search. Create a lookup table to save the id of the parent. Now - the important step is finding all tickets linked to that parent (ABC-3) with the link you use (in this case "is blocked by"). I added an audit step in here. Once you do all that, you need a branch to perform the concatenation to the parent (ABC-3) only. Since you've "saved" the id for the parent, you search for it using JQL, clear the Favorite color field, refetch the data, and then edit that field to concatenate all the values from all issues linked with our specific link. Because there could be multiple linked tickets (ABC-1, ABC-2 in my example), we use the # and the / in the JSON so that it loops and grabs all the values from all the possible linked tickets, and concatenates them.
- When value changes for Favorite Color
- Any if statements needed (i.e. Issue Type is one of Task)
- Then: Lookup work items
- Search for work items using JQL issue IN linkedIssues({{triggerIssue.key]], "Blocks")
- If: Compare two values
- Checks if: {{lookupIssues.size}} is greater than 0
- Then: Create lookup table
- Create a lookup table to use in smart values
- {{parent}}
- Lookup table name: parent
- Define table entries
- Key: parentKey
- Value: {{lookupIssues.key}}
- And: Lookup work items
- Search for work items using JQL:
- issue IN linkedIssues({{parent.get("parentKey")}}, "is blocked by")
- (OPTIONAL) And: Add value to the audit log
- {{lookupIssues.customField_XXXX.value.flatten.distinct}}
- BRANCH
- For JQL
- id = {{parent.get("parentKey")}}
- Then: edit work item fields
- Choose field "Favorite Color" and leave blank to clear anything there
- And: Re-fetch work item data
- And: Edit work item fields (Advanced)
- {
"update": {
"customfield_XXXX": [
{{#lookupIssues.customField_XXXX.value.flatten.distinct}}
{
"add": { "value": "{{.}}" }
} {{^last}},{{/}}
{{/}}
]
}
}