elsa-core/src/modules/Elsa.Workflows.Runtime/Services/TriggerInvoker.cs
Sipke Schoorstra 66123a7dc8
Add support for passing initial variables
Introduce the ability to pass variables into workflow invocations. Updates include adding variables to workflow execution options, requests, and scheduling logic. This enhancement allows dynamic variable management during workflow execution and instance creation.
2025-03-08 11:47:58 +01:00

20 lines
768 B
C#

namespace Elsa.Workflows.Runtime;
public class TriggerInvoker(IWorkflowStarter workflowStarter) : ITriggerInvoker
{
public async Task<StartWorkflowResponse> InvokeAsync(InvokeTriggerRequest request, CancellationToken cancellationToken = default)
{
var startRequest = new StartWorkflowRequest
{
Workflow = request.Workflow,
CorrelationId = request.CorrelationId,
Input = request.Input,
Variables = request.Variables,
Properties = request.Properties,
ParentId = request.ParentWorkflowInstanceId,
TriggerActivityId = request.ActivityId,
};
return await workflowStarter.StartWorkflowAsync(startRequest, cancellationToken);
}
}