Forums

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

Automation help - How to Use local variable outside of branch

Priyanka Agrawal November 16, 2025

I have an automation rule that receives a payload from an external system.
Example payload is as below-


"payload": {
"eventName": "add_update_shipment_info",
"version": "2.0",
"opportunityName": "abc-34514",
"shipment_name": "WH/OUT/abc-34514/1",
"shipment_id": "473397",
"shipment_url": "https://www.xyz.com",
"shipment_status": "Planned",
"committed_ship_date": "2025-10-14T09:30:00Z",
"planned_ship_date": "2025-10-14T09:30:00Z",
"actual_ship_date": null,
"committed_pickup_date": "2025-10-14T10:00:00Z",
"planned_pickup_date": "2025-10-14T10:00:00Z",
"actual_pickup_date": null,
"committed_delivery_date": "2025-10-22T03:45:00Z",
"planned_delivery_date": "2025-10-22T03:45:00Z",
"actual_delivery_date": null,
"tracking_info": {
"carrier": null,
"shipping_method": null,
"shipment_source": null,
"tracking_code": null,
"tracking_url": null,
"number_of_boxes": null,
"delivery_status": null,
"signed_by": null
},
"mfg_dris": [
{
"platform_user_id": 68549,
"email": "priyanka.agrawal@xyz.com",
"first_name": "Priyanka",
"last_name": "Agrawal"
},
{
"platform_user_id": 68550,
"email": "abc.def@xyz.com",
"first_name": "abc",
"last_name": "def"
},
{
"platform_user_id": 68551,
"email": "api-jira@xyz.com",
"first_name": "API",
"last_name": "Jira"
},
{
"platform_user_id": 68553,
"email": "api-auto@xyz.com",
"first_name": "api",
"last_name": "auto"
}
]
}
}


The payload contains multiple email addresses under mfg_dris.
I need to tag all these users in an issue (created after the branch) in a custom field called MFG-DRI, which is a multi-user field.

I'm successfully fetching the account IDs for each email address via the Jira REST API by looping over each email address from the payload and storing them in a variable.
However, I'm unable to access or use that variable outside the branch in order to update the custom field on the issue.

I've tried several approaches, such as:

- Initialising the variable before the branch

- Creating the issue first and then updating it using the account IDs via the Update Issue API

…but none of these methods have worked so far.

Could anyone suggest the correct way to use the variable (containing the account IDs) outside the branch so I can populate the MFG-DRI field on the issue?

Another approach I tried is:
1. Create the issue first and then fetch the account IDs inside a branch by looping over each email address from the payload.
2. Store the account IDs in a text custom field.
3. Use "Update issue" API to update MFG-DRI field on the newly created issue by copying values from the text custom field on step 2.

But, this solution causes parallel race condition i.e. multiple automation actions run at the same time to update the same issue, and they overwrite each other or run in the wrong order) when there are more email addresses (I tried for 4 email addresses).

See screenshot for the automation I tried:
image.jpg

 

and here is what I mean by parallel race condition:
image (7).png

Please suggest if you know a way to tag all the email addresses from the payload to a multi user field. The count of email addresses may vary in the payloads.

0 answers

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