Add workflowContext global JS variable
This commit is contained in:
parent
eb09fcc7ff
commit
5dd2c0be34
|
|
@ -157,6 +157,7 @@ namespace Elsa.Services.Models
|
|||
public T? GetOutputFrom<T>(string activityName, Func<T?> defaultValue) => (T?) GetOutputFrom(activityName, defaultValue())!;
|
||||
public T? GetOutputFrom<T>(string activityName, T? defaultValue) => (T?) GetOutputFrom(activityName, () => defaultValue)!;
|
||||
public void SetWorkflowContext(object? value) => WorkflowExecutionContext.SetWorkflowContext(value);
|
||||
public object? GetWorkflowContext() => WorkflowExecutionContext.GetWorkflowContext();
|
||||
public T GetWorkflowContext<T>() => WorkflowExecutionContext.GetWorkflowContext<T>();
|
||||
|
||||
public JObject GetActivityData(string activityId)
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ namespace Elsa.Services.Models
|
|||
|
||||
public T GetOutputFrom<T>(string activityName) => (T) GetOutputFrom(activityName)!;
|
||||
public void SetWorkflowContext(object? value) => WorkflowContext = value;
|
||||
public object? GetWorkflowContext() => WorkflowContext;
|
||||
public T GetWorkflowContext<T>() => (T) WorkflowContext!;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ namespace Elsa.Scripting.JavaScript.Handlers
|
|||
engine.SetValue("input", activityContext.Input);
|
||||
engine.SetValue("correlationId", workflowInstance.CorrelationId);
|
||||
engine.SetValue("currentCulture", CultureInfo.InvariantCulture);
|
||||
engine.SetValue("workflowContext", activityContext.GetWorkflowContext());
|
||||
|
||||
// NodaTime types.
|
||||
RegisterType<Instant>(engine);
|
||||
|
|
|
|||
Loading…
Reference in a new issue