Forums

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

How to update a multi-user field from multiple Assets in a branch using Jira Automation?

Kurtis
Contributor
May 13, 2025

What My Automation Is Trying to Do

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.

Context:

  • 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”).


What the Automation Does

  • 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


Problem I'm Running Into

  • 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.


What I Suspect (but need help confirming)

  • 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


What I Need Help With

  1. 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?

  2. Is it possible to restructure this rule without using variables, perhaps by updating the field directly from lookupObjects inside each branch iteration?

  3. Is the observed behavior — only one user added per execution — expected with variables inside branches?

 

2 answers

0 votes
Kurtis
Contributor
May 14, 2025

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. 

 

Screenshot 2025-05-14 071619.pngScreenshot 2025-05-14 071614.png

Screenshot 2025-05-14 071255.pngScreenshot 2025-05-14 071245.pngScreenshot 2025-05-14 071233.pngScreenshot 2025-05-14 071200.pngScreenshot 2025-05-14 071126.png

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.
May 14, 2025

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.

Kurtis
Contributor
May 14, 2025

Done - Thank you

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.
May 14, 2025

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/ 

Kurtis
Contributor
May 14, 2025

Thank you, but this was unsuccessful. Please see the error in the log screenshot. 

Screenshot 2025-05-14 143635.png

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.
May 15, 2025

HI @Kurtis 

Based on the action you want, replace the word update with set or add.

Kurtis
Contributor
May 15, 2025

This removed the error, but it doesn't populate the field.

Screenshot 2025-05-15 144822.png

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.
May 16, 2025

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")
   }
}

 

Kurtis
Contributor
May 16, 2025

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. 

Screenshot 2025-05-16 104425.png

For more context., I'm adding images showing the fields I'm working with.

  • The location field has the potential to include multiple locations.
  • Each location has a different person assigned to it in the object and there are two different schemas in the tree, one for Location Managers and the other for FSQA Managers. Each tree lists the same locations but different people for each. 
  • I originally used a branch because I had to look at each location in the "Production Location" field and grab the respective user from that asset object for each tree. 
  • I was doing this in 2 different branches, one for Location and the other for FSQA. This way I could simplify the JSON and avoid complications/errors. 
  • Everything works great until it's time to add the list of users to the Multiuser Select custom fields. It hits the first user in the variable I create and then stops processing the others. 
  • If I leave that user or remove them from the custom field and run the automation again, it adds the second person in the variable. This is very odd because this occurs no matter if clear the custom field or not. I would think that if I clear the custom field, it will at least just add the same person again. 

 

Screenshot 2025-05-16 102045.pngScreenshot 2025-05-16 101851.pngScreenshot 2025-05-16 101425.png

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.
May 16, 2025

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.

Kurtis
Contributor
May 16, 2025

Is there anything I can do to adjust my config to accommodate my needs? 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events