Forums

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

Issue adding values to assets based custom fields from children to the parent

janez_m
Contributor
August 29, 2025

Hey all, this one is really a doozy and I can't figure it out.

User request is to add the values from one asset based field of the child to the parent when child is closed. The issue I have is whatever I do every automation rule fails or clears previus values and does not add new ones.

I have read many the docs and consulted with Atlassian AI, Google AI, ChagtGPT, but all seem to be stuck in a loop. 

I have to check the values the parent has and the ones child has and then deduplicate them and try to instert them to the parent - this is because I cannot use a simple "add" operation for Assets-based custom field - meaning: only "set" is supported. This means you can't append values to an Assets field; you can only overwrite the entire field with a new set of values.

Tried different variables/smart values and even changed the rule to be a global one so I could use Lookup objects, which was one of the suggestions.

For example, this is a variable "combinedFeatures" to combine the Features (the name of the assets based field I am trying to copy/add):

{{#triggerIssue.fields.customfield_10196}}{{id}},{{/triggerIssue.fields.customfield_10196}}{{#issue.fields.customfield_10196}}{{id}},{{/issue.fields.customfield_10196}}

In debug log I see that it produces:

combinedFeatures: [ { "id": "4046" } , { "id": "4049" } ]

And then I am editing the parent field inside a branch with this JSON:

{
"fields": {
"customfield_10196": {{combinedFeatures}}
}
}

This example is one of the simpler ones and it is failing with:

(ID 4046 did not have the expected format (customfield_10196))

I had also other ones that had keys instead of ids

combinedFeatures: [ { "key": "INTASSET-4046" } , { "key": "INTASSET-4049" } ]

and the rule reported 

Issues edited successfully

while it only deleted values from the parent field where it should add them. I have tried many combinations.

Anybody had a similar issue? What would be a solution?

2 answers

0 votes
Marc - Devoteam
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.
August 29, 2025

Hi @janez_m 

You need the 2nd option at least, with the keys.

It might be an option to use, the smart clause flatten(), this should provide the output as a list.

janez_m
Contributor
September 1, 2025

Hey Marc,

Thank you for the answer, if I understand correctly, you mean I should use this format when you say 2nd option with keys?

combinedFeatures: [ { "key": "INTASSET-4046" } , { "key": "INTASSET-4049" } ]

But this format deletes prevoius entries and does not add new ones?

Marc - Devoteam
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.
September 1, 2025

Hi @janez_m 

An Asset field doesn't have an add option.

If you want to add options to an assets field, you will need to store this information first in a variable and then on the edit of the field the variable and the new option will need to be provided.

janez_m
Contributor
September 2, 2025

Hey @Marc - Devoteam,

Thank you. With the help of support I was able to construct a correct variable to combine the features and add them to the field. The format for variable I used was like this if it will help somebody in the future:

{{#triggerIssue.fields.customfield_10196}}"{{key}}"{{^last}},{{/last}},{{/triggerIssue.fields.customfield_10196}}{{#issue.fields.customfield_10196}}"{{key}}"{{^last}},{{/last}}{{/issue.fields.customfield_10196}}

Now it works and adds new values to the parent!

Like Marc - Devoteam likes this
janez_m
Contributor
September 4, 2025

But there was an issue with this solution - it does not work for multiple values being copied. 

The next solution looks like it finally has all the edge cases covered:

{{#triggerIssue.fields.customfield_10196}}"{{key}}"{{^last}},{{/last}}{{/triggerIssue.fields.customfield_10196}}{{#if(triggerIssue.fields.customfield_10196.size)}}{{#if(issue.fields.customfield_10196.size)}},{{/}}{{/}}{{#issue.fields.customfield_10196}}"{{key}}"{{^last}},{{/last}}{{/issue.fields.customfield_10196}}

 

0 votes
janez_m
Contributor
August 29, 2025

Maybe I should add the the biggest issue are commas that are in the strings when there is no value in a field or only one value.. Usually all the parsed smart values had commas in them causing a not valid JSON error

Suggest an answer

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

Atlassian Community Events