Skip to main content

Wait for External Event Async

  The Wait for External Event Async construct in allows a workflow to pause execution asynchronously until a specific event is received via the Raise Event mechanism. Unlike the synchronous version, this allows the workflow to continue execution until it reaches an await step on the activity.

How It Works​

Use Wait for External Event either in an assignment or within WhenAny, WhenAll constructs to properly receive and process the data.

  1. Workflow execution continues until an await step is encountered.
  2. The workflow pauses at the await step and waits for an external event.
  3. An external system triggers the event, providing the required data.
  4. The workflow captures and processes the event data.
  5. The workflow resumes execution and performs actions such as, triggering tasks, or making decisions based on the received input.

The workflow can be configured to handle different event outcomes dynamically, defining specific rules or logic to process varying conditions.

PropertyDescriptionComments
LabelA label for identifying the event.Used for easy reference.
Event Name*The name of the event that the workflow is waiting for to resume execution.
Input Type*Specifies the type of data expected.Helps validate incoming data.
Activity Handle*Unique identifier required for Asynchronous execution.This will be awaited when required. Activity Handle is used to track and manage asynchronous activities. Since asynchronous operations do not return responses immediately, the Activity Handle acts as a reference to monitor the execution and retrieve results when available
CommentSpecify whether to comment this construct or not. Either Yes or No.If marked as Yes, the construct is treated as a commented expression and ignored in code generation.
DescriptionExplains the purpose and impact of the event.Helps in workflow design and understanding.

'Note: ' + ($args[0].Groups[1].Value -replace '\r?\n', ' ')

Edge Paths​

Double-click on the edge path to configure the properties as required and then click Save.

PropertyDescriptionComments
TypeSelect type of the edge path. Choose one of below: expression default afterExpression field is visible only when the selected Type ‘expression’. expression: expression is the value or variable that is evaluated and compared against different case values. “Wait for external event async” construct allows user to create multiple edge paths of type ‘expression’ as cases. The execution flow depends on whether the expression matches one of the predefined cases. default: when no matching case is found for the given expression. It serves as a fallback option. after: Used to specify the logic run outside the Wait for External Event.

Example Use Case​

Scenario: Asynchronous Order Processing​

In an e-commerce application, after an order is placed, the workflow waits for payment confirmation before proceeding with order fulfillment.

Workflow Steps:

  • Step 1: Customer places an order.
  • Step 2: The workflow continues processing other steps (e.g., generating an order ID, sending confirmation email).
  • Step 3: The workflow reaches the Wait for External Event Async step and pauses execution at the await point.
  • Step 4: The payment gateway sends a Raise Event when payment is successful.
  • Step 5: The workflow resumes execution and moves to order fulfillment.