Invoke Code

Runs a block of C# or VB code with declared In, Out and InOut parameters.

Behaviour

Built-in workflow activity · type id velophex.invokecode

Risk High

The engine declares Invoke Code a High risk activity because it runs authored code.

Properties#

Input#

Language#

Language · String · Required · Default: The workflow's expression language

The language of the code, chosen per node; it does not have to be the workflow's. Choices: C#, VB.

Code#

Code · String · Required · Default: Not specified

Statements run with the parameters below as locals, and cancellationToken. Edit code opens the code editor, which compiles as you check.

Parameters#

Parameter name#

Parameter:{n}:Name · String · Required · Default: Not specified

The parameter's name in the code. Clear it to remove the parameter. Typing a name in the Add parameter row adds an In parameter of type String.

Direction#

Parameter:{n}:Direction · String · Required · Default: In

In: passed to the code. Out: written back when the code completes. InOut: both.

Type#

Parameter:{n}:Type · Type · Required · Default: String

The parameter's type.

Value#

Parameter:{n}:Value · The parameter's type · Required · Default: Not specified

The value the parameter starts with. Shown for In and InOut parameters.

To#

Parameter:{n}:To · The parameter's type · Optional · Default: Not specified

Variable or argument that receives the parameter's final value. Empty: the value is dropped. Shown for Out and InOut parameters.

Common#

Timeout#

Timeout · TimeSpan · Optional · Default: Not specified

How long the activity may take, all attempts and retry waits included; e.g. 00:00:30. When it elapses the activity fails with VXF-ACTIVITY-TIMEOUT, which is not retried. Cooperative: an activity that ignores the cancellation is abandoned and may still finish its work. Empty: no limit.

Continue on error#

ContinueOnError · Boolean · Optional · Default: False

When True and the activity fails (after its retries), the fault is logged as a warning and the workflow continues with the next activity; its output variables keep their values. A stop is never swallowed. Empty: False.

How it works#

Invoke Code runs a statement-bodied block of C# or Visual Basic. The code language is chosen per node and is independent of the workflow's expression language. In and InOut parameters are supplied by their Value expressions. Out and InOut parameters are written back to their To targets when the code completes. The code receives a cooperative cancellation token.

Properties

Input

Parameters

Common

How it works