Action that executes different actions based on a condition

Example

// Simple condition with action execution
await runAction({
ActionName: 'Conditional',
Params: [{
Name: 'Condition',
Value: 'value > 100'
}, {
Name: 'Context',
Value: { value: 150 }
}, {
Name: 'TrueAction',
Value: {
ActionName: 'Send Single Message',
Params: {
MessageTypeID: 'alert-id',
To: 'admin@example.com',
Subject: 'High Value Alert'
}
}
}, {
Name: 'FalseAction',
Value: {
ActionName: 'Calculate Expression',
Params: { Expression: 'value * 0.9', value: 150 }
}
}]
});

// With passthrough context
await runAction({
ActionName: 'Conditional',
Params: [{
Name: 'Condition',
Value: 'user.role === "admin"'
}, {
Name: 'Context',
Value: { user: { role: 'admin', id: 123 } }
}, {
Name: 'PassthroughContext',
Value: true
}, {
Name: 'TrueAction',
Value: {
ActionName: 'Get Record',
Params: { EntityName: 'Admin Settings' }
}
}]
});

Hierarchy (view full)

Constructors

Methods

  • Executes actions based on a condition

    Parameters

    • params: RunActionParams<any>

      The action parameters containing:

      • Condition: JavaScript expression string to evaluate (required)
      • Context: Object with variables for condition evaluation (optional)
      • TrueAction: Action configuration to run if condition is true (optional)
      • FalseAction: Action configuration to run if condition is false (optional)
      • PassthroughContext: Boolean - pass context to child actions (default: false)
      • StrictMode: Boolean - use strict mode for evaluation (default: true)

    Returns Promise<ActionResultSimple>

    Result from executed action or condition result

  • Executes the action with the provided parameters.

    Parameters

    • params: RunActionParams<any>

      The action execution parameters including context

    Returns Promise<ActionResultSimple>

    Promise resolving to the action result