elsa-core
elsa-core copied to clipboard
[ENH] Add support to initialize the workflow context programmatically
In Elsa 2 we have the possibility to set a WorkflowContextId before dispatching a StartableWorkflow.
In Elsa 3 the workflows works as a module and we cant initialize the workflow context programmatically before we dispatch a workflow.
Example of use case:
I have a model Order (my custom context provider) that is the core of my workflow definition so my first activity start iterating all the products of this order to make things.
So it is very important to have the custom context available from the initial moment
Would it work for you if you can reuse the "input" parameter when executing or dispatching a workflow, and then from your workflow, you can read that input and use the SetWorkflowContextParameter
activity to set the context value using a dynamic expression that reads from the input? Basically, this example?
Right now to test I'm doing something like this, but from Elsa Studio I can't configure the context because of this:
https://github.com/elsa-workflows/elsa-studio/issues/75
Terminating the Activity, you could set the context at the start of the flow with the input as comments
It would still be nice to have a more direct way to pre-initiate the context