elsa-workflows / elsa-workflows/elsa-core
Update JS evaluator to read back variables
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
Although scripts can update WF variables, we never write them back into WF variables (unless the user does so explicitly using the `setVariable` function.
We could implement this like this (pseudo code):
```csharp
// Before script execution, we set all WF variables (nothing to change here).
// After script execution, read back variables and update WF variables:
foreach(var variable in workflowVariables)
{
var updatedValue = engine.GetValue(variable.Name);
workflowContext.SetVariable(variable.Name, updatedValue);
}
```
_Originally posted by @sfmskywalker in https://github.com/elsa-workflows/elsa-core/discussions/2446#discussioncomment-1681417_
Contributor guide
Assessment
This issue has not been assessed yet.