Hi dear Community,
I'm stumped that I can't get the solution of How-to-combine-values-from-various-multiple-select-fields to work in my usecase.
The setup:
The problem is quite similar to the question linked above. I have a top-level Movement issuetype that has children of the Initiative issuetype. On both the Movement and Initiative issuetypes I have the same custom field (customfield_10301, which I'll call "Domain" in the rest of this post) that is a multiselect list with five possible entries (call them A, B, C, D and E).
My Goal:
If the Domain entry of one of the Initiatives changes, I need to reflect that change in the value of the Domain entry that resides on the parent Movement Jira item.
Example:
Initiatives 1 and 2 are children of Movement X , and their customfield is filled like this:
Initiative 1 Domain: A, B, D, E
Initiative 2 Domain: A, C
Movement: Domain: A, B, C, D, E
If the Domain value of initiatieve 1 changes to A, B, D, Movement X to be filled with: A, B, C, D (which is a logical "or" executed on the values of the Domains of its children).
Step by Step:
0: The trigger of the automation would be a change in the Domain value of an Initiative
- When: Value changes for Domain
Followed immediately by the check if it's an Initiative that we're dealing with:
- If: Issue Type equals Initiative
And checking if the Initiative indeed has a parent Movement
- If: Compare two values: Check if: {{triggerIssue.parent link}} does not equal Empty
1: As per @Bill Sheboy's solution in the link above, I first lookup the issues:
- lookupIssues JQL: 'parent link' = {{triggerIssue.parent link}}
And I verify the lookup by logging it (the correct issues are looked up) using
- Add value to the audit log:
Looked Up are: [{{lookupIssues.key}}].
This indeed gives me the initiatives that are children of the parent Movement of the trigger Initiative (the square brackets are there to more easily see an empty result).
2: I then branch into the parent Movement by
- For JQL
issue = {{triggerIssue.parent link}}
and then apply the magic in Bill's solution by editing the Movement using the more options and then Json with the smart values on the looked-up Jira items:
{
"update": {
"customfield_10301": [
{{#lookupIssues.customField_10301.value.flatten.distinct}}
{
"add": { "value": "{{.}}" }
} {{^last}},{{/}}
{{/}}
]
}
}
3: As you might've guessed (if you've read so far), the magic didn't happen in my case.
I've been dabbling with creating variables inside the automation and writing their content to the audit log, to find out what is going on. It seems that as soon I'm using either flatten or distinct, I end up with an empty Domain value.
What am I missing here?
Kind regards,
Dick