Forums

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

Combining values from a bunch of Jira Items with a multiple select custom field.

Dick
Community Champion
August 28, 2026

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

 

5 answers

1 accepted

0 votes
Answer accepted
Ivan Manolov _Appfire_
Atlassian Partner
August 31, 2026

Hello @Dick,

Your diagnosis looks right to me: on Data Center, the Lookup Issues action only exposes a limited set of stock fields, so {{lookupIssues.customfield_10301}} comes back empty no matter what you chain after it. That matches the open suggestion you linked, and it explains why the same rule works for @Lalithesh on Cloud.

Since you're heading down the web request route, the shape that should work on DC:

  1. Send web request (GET) to /rest/api/2/search?jql='parent link' = {{triggerIssue.parent link}}&fields=customfield_10301, with "Delay execution" enabled so the response is available to later steps.
  2. Build the union from the web response smart values (the option values sit in the response JSON under fields.customfield_10301[].value).
  3. Send web request (PUT) to /rest/api/2/issue/{{triggerIssue.parent link}} with the update JSON in the body.

Use a dedicated service account token for the auth header rather than a personal one, and log {{webResponse.status}} to the audit log while testing. The exact smart value names vary a little between DC versions, so verify them with an audit log entry first.

Best,

Ivan

Ivan Manolov _Appfire_
Atlassian Partner
August 31, 2026

Following up on my earlier answer, @Dick: depending on why the Movement needs the combined value, there may be a way to skip the write-back entirely. If you're open to using an app from the Atlassian Marketplace, JXL for Jira can help with this. Specifically, its formula columns allow you to compute the union of the children's Domain values live on each Movement row:

const values = this.hierarchy.children
  .flatMap(c => c.domain ?? [])
  .map(o => o.value);
return [...new Set(values)].join(", ");

It runs on Data Center, and the Movement > Initiative relationship works through the same Parent Link your hierarchy already uses. The computed value updates as Initiatives change and comes along in exports. The caveat: it's a display column, so if other JQL or boards must read the real Domain field on the Movement, your REST route is still the right call.

Disclosure: I work for the team that builds JXL.

All the best,

Ivan

Dick
Community Champion
August 31, 2026

Hi @Ivan Manolov _Appfire_,
A couple of things I would like to mention:

  • First: please say hello to Hannes from me :) We did some debugging on JXL together.
  • I need the value stored on the movement as I use it to gather Jira Items for displaying purposes, so I need to get the REST route working. 
  • jql='parent link' = {{triggerIssue.parent link}} returns an error "URL failed to Parse" in the Send web request, with a remark that I should use: {{value.urlEncode}} for the smart value. This sadly doesn't port to the {{ }} in the jql, neither when I first declare the MovementKey variable as MovementKey = {{triggerIssue.parent link}} and then use {{MovementKey.urlEncode}} in the jql. 
  • The single quotes around parent link are a god-sent to me. Thank you for that.
    The Atlassian suggested usage double quotes on the "how to get the url-friendly version using the url of an issue search action" didn't work. 

So the story to nailing this continues. 

Kind regards,
Dick

Like Ivan Manolov _Appfire_ likes this
Dick
Community Champion
August 31, 2026

Tiny result
Using:
<our instance>/REST/API/3/search?jql=%27parent%20link%27%20%3D%20{{MovementKey}}

gives me a Response 200 and a 

Request GET with the complete path

The {{webhookResponse.body}} however contains a lot of stuff that isn't related to specific Jira Items. Even this came along: 

{{webhookResponse.body}}

{\u0022product\u0022:\u0022jira\u0022,\u0022destination\u0022:\u0022/REST/API/3/search?jql\u005Cu003d%27parent%20link%27%20%3D%20DIR-1\u0022,\u0022forgotLoginDetailsUrl\u0022:\u0022/secure/ForgotLoginDetails.jspa\u0022,\u0022signupUrl\u0022:\u0022/secure/Signup!default.jspa\u0022,\u0022permissionsViolationContext\u0022:{\u0022showLoginForm\u0022:true,\u0022warningMessages\u0022:[\u0022\u005Cu0027starm001\u005Cu0027 does not have permission to access this page.\u0022,\u0022If you think you shouldn\u005Cu0027t get this message, please contact your Jira administrators.

DIR-1 is indeed the MovementKey. But I'm admin of this Jira instance, and all the projects that are in scope of the Automation that runs the Webrequest. I'm a bit baffled by the permissions violation. 

Here's hoping :)
Dick

Like Ivan Manolov _Appfire_ likes this
Ivan Manolov _Appfire_
Atlassian Partner
August 31, 2026

Hi @Dick,

I'll pass the greetings along :)

Your 200-with-login-page result can be caused by two things, fixable in the web request config:

  1. Wrong API version for Data Center. /rest/api/3/ only exists on Cloud. On DC use lowercase /rest/api/2/search?... (or /rest/api/latest/). Your uppercase /REST/API/3/ path doesn't hit the REST servlet at all, which is why Jira answered with a regular web page instead of JSON.

  2. The request is anonymous. A web request doesn't inherit the automation actor's session, so Jira treated the call as not-logged-in ('starm001' and the login form in the body are the giveaways). Add two headers to the action: Authorization: Bearer <token> using a Personal Access Token (create one under the service account's profile, Personal Access Tokens, available since Jira 8.14), and Accept: application/json.

Before wiring this back into the rule, I'd prove the calls outside automation with curl (or Postman: Authorization tab, type Bearer Token). That separates Jira-side URL/auth problems from smart value problems:

curl -s -H "Authorization: Bearer <PAT>" -H "Accept: application/json" \
  "https://<your-instance>/rest/api/2/search?jql=%27parent%20link%27%20%3D%20DIR-1&fields=customfield_10301"

If that returns the children with their Domain values, the same URL and headers dropped into the Send web request action will too. The PUT can be tested the same way (against a test Movement first, since it overwrites the Domain field):

curl -s -X PUT -H "Authorization: Bearer <PAT>" -H "Content-Type: application/json" \
  -d '{"fields":{"customfield_10301":[{"value":"A"},{"value":"B"}]}}' \
  "https://<your-instance>/rest/api/2/issue/DIR-1"

Once both work standalone, in the rule log {{webhookResponse.body.issues.key}} to confirm the response parses, then try building the union with {{webhookResponse.body.issues.fields.customfield_10301.value.flatten.distinct}} before the PUT step.

On the urlEncode parse error: your manual percent-encoding is a perfectly fine permanent fix, no need to fight the smart value there.

Cheers,

Ivan

Dick
Community Champion
September 1, 2026

Hi Ivan,

It was your point 1: The call to the api had flaws. 

/rest/api/2/search?jql=%27parent%20link%27%20%3D%20{{MovementKey}}

gives me the initiatives now properly using the log action with this message:

Looked up issues = [ {{webhookResponse.body.issues.key}} ]

I already added the Authorization and Bearer <PersonalAccessToken> combination in the managed secret keys section of Jira, which meant I could rule-out your second suggestion. 

Thank you kindly for your support in this matter. 
Dick

Like Ivan Manolov _Appfire_ likes this
Dick
Community Champion
September 1, 2026

A silver lining, but in the end falling flat on my face: 

  • The correct issues are found using the webrequest.
  • The correct domains are found inside two arrays when polling the domain customField of these issues.
  • Then flatten in all it's combinations came along and wiped the content of the domain customField arrays.
  • Even distinct isn't looking across a display's border. Yes, I know that a select list has distinct values. 

Why isn't flatten working for me?

OpenJDK-21 perhaps?

 

Automation falls flat.png

 

0 votes
Dick
Community Champion
August 28, 2026

Ow bummer: Lookup issue action - Add support for more fields on JIRAAUTOSERVER-877 

this should've been tackled for Jira Datacenter 3 years ago...

My list is empty to begin with!

Dick
Community Champion
August 28, 2026

Going for the How to sum story custom filed values to an epic? solution using web request to the REST API mentioned in the comments by Bill. 

0 votes
Dick
Community Champion
August 28, 2026

Hi there, @Lalithesh.

It seems that you use Jira Cloud. I'm using Datacenter version 10.3.24 (indicated in the tags on the right). I'm sorry, but I'm not particularly looking for a confirmation that the solution works in Jira Cloud.

Hi there, @Gor Greyan 

I noticed the extra parenthesis after flatten(), which were neither present in the referred, nor my solution. That would be a good catch, I'll try it and report back. 

Thank you both for your efforts regarding this. 
Kind regards,

Dick

 

Dick
Community Champion
August 28, 2026

These pictures contain the test Gor asked. The parentheses after flatten are not making a difference. 

I'm now suspecting our underlying Java (openJDK-21). 

Kind regards,
Dick

Automation - Flatten Audit Log.pngAutomation FlattenChecked.png

Like Gor Greyan likes this
Lalithesh
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 Champions.
August 28, 2026

Ah okay. Apologies, I missed the tags

Gor Greyan
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 Champions.
August 30, 2026

Hi @Dick

Thanks for the reply.

The interesting part of your audit log is that the lookup itself works correctly, while the Domain expression is already empty before distinct really becomes relevant.
I would therefore go one level simpler and inspect how Automation for DC is exposing this particular multi-select field.
Could you try logging these directly, without flatten or distinct? {{triggerIssue.customfield_10301}}
{{triggerIssue.customfield_10301.value}}

and, after the Lookup

{{lookupIssues.customfield_10301}}
{{lookupIssues.customfield_10301.value}}
I'd use the field ID rather than Domain for this test, just to remove field-name resolution from the equation.

Regards,
Gor

0 votes
Lalithesh
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 Champions.
August 28, 2026

Hi @Dick 

I was able to reproduce the automation using the details shared here, and it worked without any issues.

Automation screen grab for referenceScreenshot 2026-08-28 114743.jpg

Cheers!

Lalithesh
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 Champions.
August 28, 2026

wee change to the Edit action: the update function will only add value but it will never remove values that are removed from the child tasks.

Use this JSON instead

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

0 votes
Gor Greyan
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 Champions.
August 28, 2026

Hi @Dick

I think the issue is with the structure returned by the multi-select field, not the lookup itself.

lookupissues gives you a list of work items, and each work item has its own list of Domain options. So effectively you have a list of lists. You need to flatten that collection first and then apply distinct.

I would first test this directly in the audit log:

{{lookupIssues.customfield_10301.value.flatten().distinct}}

With your example:

Initiative 1 --- A, B, D
Initiative 2 --- A, C

This should return

A, B, D, C

I found that funcitions here.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists

One thing I would change in your JSON is that you're using the option values to build the update manually. For a multi-select field, I would first confirm exactly what Automation is returning before constructing the JSON. 
Please set these 3 logs; they will tell us at what level the value becomes empty.

{{lookupIssues.customfield_10301}}
{{lookupIssues.customfield_10301.value}}{{lookupIssues.customfield_10301.value.flatten().distinct}}

Regards,
Gor

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
10.3.24
TAGS
AUG Leaders

Atlassian Community Events