Forums

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

Automation - adding approvers within a "For AQL" branch yields unexpected results

Malcolm Rogers
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 22, 2025

Hello all. I am trying to automate dynamically adding approvers to a task but the order of operations within the branching logic is preventing it from working consistently. Due to other factors within our environment, I am pulling user information out of Assets when adding approvers. I pull these users into an object in the For AQL statement, then use an Edit Work Item step to update the Approvers field, which is a multi-user select field. It seems that this branch is not working sequentially, as it seems random who the approvers end up being.

Clipboard_08-22-2025_01.jpg

I added the "Re-fetch work item" step in an attempt to work around this and hopefully force it to wait for the edit step to finish. You can see in the Activity that the updates happen "out of sync".

Screenshot 2025-08-22 101651.jpg

I know that you can use an Approval Group, but that will not work for us due to various circumstances.

Anyone have any ideas of what I can do differently to get this field set properly? Thank you!

1 answer

1 accepted

5 votes
Answer accepted
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.
August 22, 2025

Hi @Malcolm Rogers -- Welcome to the Atlassian Community!

Without seeing your entire rule and audit log for context...

Using a branch to iteratively add the approvers (or any work item change) can cause update collisions, errors, etc.

For a scenario like this, I recommend instead:

  • using the Lookup Objects action rather than the branch to gather all the approver accountId values,
  • parse that into a Created Variable (to avoid timing problems with asset data)
  • split() that variable's text back into a list to create the dynamic JSON expression, storing that in another variable (once again, to avoid timing problems)
  • and finally using that second variable as the JSON for the update

Please let me know if you need more details on this approach.

 

Kind regards,
Bill

Malcolm Rogers
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 24, 2025

Thanks, Bill! This got me moving in the right direction towards a solution. I didn't need to use the split() function, I was able to condense it down a bit. My assets lookup is pulling back objects with a User-type field. I then used the Create Variable step to put that into JSON to get the proper key/value pairs:

{{lookupObjects.User.asJsonObjectArray("accountId")}}

Then I can use the Edit Work Item action to set the field:

{
"fields": {
"customfield_10003": {{ApproversJson}}
}
}

Thanks!!

Like Bill Sheboy likes this

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