JavaScript
In this section, we cover some of the built-in variables and functions available to the JavaScript expression syntax.
Installing the JavaScript Feature
dotnet add package Elsa.JavaScriptservices.AddElsa(elsa =>
{
elsa.UseJavaScript();
});Configuration
services.AddElsa(elsa =>
{
elsa.UseJavaScript(options =>
{
options.AllowClrAccess = true;
options.RegisterType<Order>();
options.ConfigureEngine(engine =>
{
engine.Execute("function greet(name) { return `Hello ${name}!`; }");
engine.SetValue("echo", (Func<string, string>)(s => "Echo: " + s));
});
});
});Globals
JSON
variables
getWorkflowDefinitionId
getWorkflowDefinitionVersionId
getWorkflowDefinitionVersion
getWorkflowInstanceId
setCorrelationId
getCorrelationId
setVariable
getVariable
getInput
getOutputFrom
getLastResult
isNullOrWhiteSpace
isNullOrEmpty
parseGuid
newGuid
newGuidString
newShortGuid
bytesToString
bytesFromString
bytesToBase64
bytesFromBase64
stringToBase64
stringFromBase64
streamToBytes
streamToBase64
Last updated