Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creation of variables dynamically via setVariable #4800

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

sfmskywalker
Copy link
Member

This PR addresses #4789 by allowing the JS function setVariable to dynamically create a new variable if the specified variable doesn't already exist in the current scope.

This change however, does not create a workflow variable definition, which means it will currently not be visible from the Variables panel when looking at the workflow instance viewer. This might be part of an improvement in a later iteration.

The update introduced checks if a variable exists before attempting to set its value in the ExpressionExecutionContextExtensions. If the variable doesn't exist, it now creates one automatically.

Fixes #4789
@sfmskywalker sfmskywalker changed the base branch from main to v3.0.3 January 15, 2024 20:14
The comment indicating to create a variable if it doesn't exist was deemed superfluous and removed from the ExpressionExecutionContextExtensions.cs file. This improves code cleanliness as the functionality is self-explanatory through the existing code structure.
@sfmskywalker sfmskywalker merged commit ac9428a into v3.0.3 Jan 15, 2024
1 check passed
@sfmskywalker sfmskywalker deleted the dynamic-variables branch January 15, 2024 20:15
lahma pushed a commit to lahma/elsa-core that referenced this pull request Feb 2, 2024
…lows#4800)

* Disable MassTransitRabbitMq in Elsa.Server.Web.

* Create variable if not exists in Workflow.Core

The update introduced checks if a variable exists before attempting to set its value in the ExpressionExecutionContextExtensions. If the variable doesn't exist, it now creates one automatically.

Fixes elsa-workflows#4789

* Remove unnecessary comment

The comment indicating to create a variable if it doesn't exist was deemed superfluous and removed from the ExpressionExecutionContextExtensions.cs file. This improves code cleanliness as the functionality is self-explanatory through the existing code structure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant