Repository navigation
Nested Execute Workflow: Storage variable changes are not propagated back to the parent workflow #2166
samerbashaqudstv-ai
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi Automa team,
I’m experiencing an issue (or possibly an undocumented behavior) with nested Execute Workflow blocks and Storage/Workflow variables.
My workflow structure is:
Main Workflow
↓ Execute Workflow
Sub Workflow 1
↓ Execute Workflow
Sub Workflow 2
I have a Storage variable called:
$$tempmail365
The Main Workflow starts with:
$$tempmail365 = 1
Then Sub Workflow 1 executes Sub Workflow 2.
Inside Sub Workflow 2, I change the variable:
let num = automaRefData('variables', '$$tempmail365');
if (num == 1) {
num = 4;
} else if (num == 4) {
num = 1;
}
automaSetVariable('$$tempmail365', num);
Inside Sub Workflow 2, I can confirm that the variable has changed successfully. For example:
Before: 1
After: 4
However, after Sub Workflow 2 finishes and execution returns to Sub Workflow 1, the variable does not appear to have the updated value automatically.
The same happens when returning to the Main Workflow: it may still have the previous value.
I also tested enabling:
Use all current workflow globalData
but this did not solve the issue in my nested workflow.
What I discovered
I found a workaround by explicitly reading the variable from the relevant workflow after Sub Workflow 2 finishes.
For example, in Sub Workflow 1 I use:
let id = Number(
automaRefData('variables', 'projectId')
);
let tempmail365 = automaRefData(
'workflow',
'project' + id + '.variables.$$tempmail365'
);
automaSetVariable('$$tempmail365', tempmail365);
After doing this, the updated value becomes available to the next execution cycle.
My question
Is this the expected behavior of Execute Workflow?
Specifically:
When a child workflow modifies a variable using automaSetVariable(), should that modification automatically propagate back to the parent workflow?
Does each nested Execute Workflow have its own variable/execution context?
What exactly does "Use all current workflow globalData" share between parent and child workflows?
Is there an official/recommended way to return modified variables from a nested child workflow back to the parent workflow?
If this is expected behavior, I think it would be very helpful to document it clearly in the Execute Workflow documentation, because it can be confusing when working with nested workflows.
Thank you!
All reactions