Trying to synchronize multiple select fields for parent according to children values

Flavien Gache
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2025

Hello eveybody.
In the proejct I am setting, I have parent and children issues.
I am trying to synchronize a customfield (customfield_10232) between both. Here is an example : 

Parent task has three subtasks with the following options selected : 
Subt 1 - A,C
Subt 2 - B,C
Subt 3 - E

What I want is that parent task value for the customfield is A,B,C,E.
I thought it would be quite simple with a trigger on the modification of mentioned field, request on children issue and use {{lookupIssues.customfield10232.value}} and then I would just have to branch for the parent and change the value with either simple edition or JSON.
Simple edition does not work (obviously, silly me) and via JSON, I seem to not be able to edit correctly the JSON since it seems to be an array of arrays.

Does somebody have a simpler way to do that or could help me format easily the array please ? It seems quite hard to do and I have not been able to do that until now.
Thanks in advance.

1 answer

0 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.
March 10, 2025

Hi @Flavien Gache 

The keys for solving a scenario like this are:

  • get the distinct values for the child issues
  • use list iteration to build a dynamic JSON expression
  • use a single update with JSON to avoid timing / collision problems for multiple field updates

For example, let's assume the child issues are subtasks, and we have used the Lookup Issues action with JQL to gather them.  (This will ensure all of the custom field data is loaded, rather than trusting the {{issue.subtasks}} smart value to do so.)

The distinct values from the child issues would be this, using the recently revealed flatten function to help merge the child issue array values:

{{lookupIssues.customfield_10232.value.flatten.distinct}}

With that, the dynamic JSON may be created to update the parent:

{
"fields" : {
"customfield_10232": [
{{#lookupIssues.customfield_10232.value.flatten.distinct}}
{ "value": "{{.}}" } {{^last}},{{/}}
{{/}}
]
}
}

 

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events