I'm working on a Jira Automation rule to automatically update a User Picker (multi-user) field based on the results of linked Assets objects.
I have an Assets field on my issue called Location (customfield_10871
). It's a multi-object field — meaning multiple Assets (Locations) can be selected.
Each Location object contains a user attribute (Approver
) that links to one or more Jira users — these are the people I want to add to a Jira user picker field (customfield_10896
, for example, called “FSQA Managers”).
The rule uses a “For each object” branch to iterate over each Location in the issue's Assets field.
Inside the branch:
I run a lookupObjects action to get the matching record from Assets (e.g., objectType = "FSQA Managers" AND Name = "{{locations}}"
)
I create a variable (e.g., FSQAmanagers
) and append the users returned from lookupObjects.Approver.accountId
I use an Edit issue
action with JSON that splits the variable and tries to add
each user to the multi-user field
The variable I build (FSQAmanagers
) contains multiple users — confirmed via logging.
However, only one user gets added to the field per rule execution.
If I manually re-trigger the rule, it adds another user from the same list.
My JSON uses split(",")
with a loop to add
each accountId, and I’m using the correct update
structure — but still, only one user is added per run.
I believe the issue is caused by scoping or execution order within the branch:
Each iteration of the “for each object” branch seems to create its own variable version
The edit issue
action inside the branch may be firing before the variable is fully built, or it’s only seeing part of the data
Because Jira doesn’t allow variables created in a branch to be used outside of it, I can't do the update after the loop finishes
Is there a way to reliably accumulate users from multiple Assets objects inside a branch, and then add them all at once to a multi-user field?
Is it possible to restructure this rule without using variables, perhaps by updating the field directly from lookupObjects
inside each branch iteration?
Is the observed behavior — only one user added per execution — expected with variables inside branches?
This updates each approver field:
{
"fields": {
"customfield_10896": {{issue.customfield_10929."FSQA Approver".flatten.asJsonObjectArray("id")}},
"customfield_10897": {{issue.customfield_10929."Location Approver".flatten.asJsonObjectArray("id")}}
}
}
This updates the participants:
{
"fields": {
"customfield_10032": [
{{#allParticipants.split(",").distinct}}
{"id": "{{.}}"}
{{^last}},{{/last}}
{{/allParticipants.split(",").distinct}}
]
}
}
Here are screenshots showing the automation, the JSON, and the log.
I have been hammering at this for a while now, so I don't really know what revision of the JSON I'm on and how far off or close it is to the actual solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Kurtis
Could you if you provide:
1. images that show your complete rule.
2. images showing the details of any relevant actions/conditions/branches.
3. images showing the Audit Log details for the rule execution.
These questions are not for not willing to help, but to have community members understand on how automation works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Done - Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kurtis
You could try the following, in the edit action:
{
"update": {
"customfield_10896": [ {{FSQAmanagers.flatten.asJsonObjectArray("id")}}
]
}
}
I got this info from KB; https://support.atlassian.com/jira/kb/how-to-auto-populate-approvers-from-asset-objects-attributes-using-automation-in-assets/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, but this was unsuccessful. Please see the error in the log screenshot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Kurtis
Based on the action you want, replace the word update with set or add.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This removed the error, but it doesn't populate the field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kurtis
What If you don't create a variable, but just edit the field after the lookup?
smart value in the edit action in the advanced json:
{
"fields": { "customfield_10896": {{llookupObjects.Approver.accountId.flatten.asJsonObjectArray("id")
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It will not accept that JSON in the automation. It says, An unknown error occurred. Please reload and try again.
I also tried:
{
"fields": {
"customfield_10896": [ {{llookupObjects.Approver.accountId.flatten.asJsonObjectArray("id")}}
]
}
}
This is accepted but doesn't do anything. It can't find the objects unless I use a branch.
For more context., I'm adding images showing the fields I'm working with.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kurtis
So based on your setup in assets, this will happen, as you explain.
To use the options collected in the variable, you would need to branch again based on splitting the found options, but that is not an option in a branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there anything I can do to adjust my config to accommodate my needs?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kurtis and @Marc - Devoteam
Marc, did you notice there was a typo in your suggestion where there are two "l" characters at the start of lookupObjects?
Next, in my experience dynamic JSON expressions can have timing problems when used directly in the Edit Work Item action. That is, they are not fully evaluated before processing. The workaround to determine if that is the cause is first create that entire JSON expression in a Created Variable, perhaps named varJson, and then use that in the Edit Work Item action as the JSON as {{varJson}}
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I fixed my issue.
I needed to be using a custom object field. Once I did that, I was able to greatly simplify the automation and use the following.
{
"fields": {
"customfield_10896": {{issue.customfield_10929."FSQA Approver".flatten.asJsonObjectArray("id")}},
"customfield_10897": {{issue.customfield_10929."Location Approver".flatten.asJsonObjectArray("id")}}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.