Portal Community

Class Definition

public sealed class NodeExecutionEventArgs
{
    // Identity
    public string    NodeId      { get; init; }
    public string    NodeType    { get; init; }   // TypeCode, e.g. "HttpRequest"
    public string    ExecutionId { get; init; }
    public string    ProcessId   { get; init; }
    public string    TenantId    { get; init; }

    // Context snapshot (read-only copy — mutations have no effect)
    public IReadOnlyNodeExecutionContext Context { get; init; }

    // Timing
    public DateTimeOffset StartedAt  { get; init; }
    public long?          DurationMs { get; init; }  // null in OnBefore

    // Result (only set in OnAfter)
    public NodeExecutionResult? Result { get; init; }

    // Error (only set in OnError)
    public Exception? Exception  { get; init; }
    public int        RetryCount { get; init; }

    // Skip (only set in OnSkipped)
    public SkipReason SkipReason { get; init; }
}

Property Availability by Event

PropertyOnBeforeOnAfterOnErrorOnSkipped
NodeIdYesYesYesYes
NodeTypeYesYesYesYes
ExecutionIdYesYesYesYes
ProcessIdYesYesYesYes
TenantIdYesYesYesYes
ContextYesYesYesYes
StartedAtYesYesYesYes
DurationMsnullSetSetnull
ResultnullSetnullnull
ExceptionnullnullSetnull
RetryCount00Current count0
SkipReasonNoneNoneNoneSet

Context Snapshot

The Context property exposes an IReadOnlyNodeExecutionContext — a deep copy of the execution context at the moment the event fired. It gives access to:

Snapshot, not live: Writing to Context.ExecutionMemory or any other Context property has no effect on the actual execution. The context passed to subscribers is a frozen copy.

SkipReason Enum

public enum SkipReason
{
    None,
    ConditionalBranchNotTaken,  // Edge condition evaluated to false
    ParallelPathNotActive,      // Node is on a parallel branch that wasn't chosen
    LoopIterationSkipped,       // Loop body skipped for this iteration
    ManuallyDisabled            // Node was disabled in the designer
}

Accessing NodeType

The NodeType string is the TypeCode string registered by the executor — e.g. "HttpRequest", "Approval", "SetVariable". Use it to filter your subscriber to specific node types:

public async Task OnErrorAsync(NodeExecutionEventArgs args, CancellationToken ct)
{
    // Only alert for HTTP failures, not for all node errors
    if (args.NodeType != "HttpRequest") return;

    await _alerts.SendAsync($"HTTP node {args.NodeId} failed: {args.Exception!.Message}", ct);
}