Skip to content

Automations

Overview

The Automations runs a configured automation workflow, managing task dependencies, executing tasks (including parallel branches and loops), handling errors, and returning a final result.

Usage

Configure a workflow trigger to kick off execution:

  1. Single Trigger Requirement Each workflow must define exactly one trigger node. This node is responsible for initiating the workflow when activated.

  2. Execution Modes

    • Immediate Execution: The workflow begins processing tasks as soon as the trigger fires.
    • Queued Execution: The workflow is placed into a global queue. Queued workflows execute sequentially in the order they were triggered.

Workflows can only have a single trigger. When using queued execution, workflows run one at a time in their enqueue sequence.

Returns an Automation Return containing:

  1. Initialization

    • Create a temporary working folder under C:\TEMP\{GUID}.
    • Initialize results (stores output data) and dependencyCount (tracks pending dependencies).
  2. Trigger Tasks

    • Enqueue all trigger tasks without dependencies first.
    • Inject initial parameters (e.g., files, bytes) into their UserInputs or data.
  3. Enqueue & Run

    • The internal Enqueue method handles:

      • Loop tasks (taskType == "loop"): Iterate over a collection or numeric range, cloning each child task marked for the next iteration.
      • AndOperator tasks (taskName == "And Operator"): Merge inputs from all completed parents.
    • Callbacks onTaskStarted and onTaskCompleted fire around execution.

  4. Dependency Resolution

    • On completion, decrement the dependency count for each child.
    • Enqueue any child whose count reaches zero (or all parents, for AndOperator).
  5. Special Tasks

    • QueueWorkflow: Returns Accepted (202), ending execution early.
    • DataReturnObject: Returns OK (200) with the provided data payload.
  6. Completion & Cleanup

    • Await all tasks or a cancellation.
    • Log final status, report via insights service, delete the working folder, and return the AutomationReturn.

Loop Tasks

Loop tasks require one of:

  • Array Object: An expression yielding a collection.
  • Count: A positive integer specifying iteration count.

Per iteration:

  • Clone each child task whose configured link name ends with Next.
  • Inject into each clone: LoopItem, IterationIndex, IterationCount, and LoopNodeId.
  • After the final iteration, a child link ending with Finished may enqueue a final task.

Note: Confirm the naming conventions for loop link labels (Next / Finished).

Error Handling & Cancellation

  • A failing task (taskSuccess == false) cancels remaining tasks.
  • Error messages accumulate in logs and the final Automation Return (typically a 500 code).

Logging & Insights

  • Console output for progress and debug lines.
  • Remote insights service logs on start and completion, including status and errors.

Return Values

  • Accepted (202): Workflow queued a follow‑up workflow (QueueWorkflow).
  • OK (200): Workflow returned data immediately (DataReturnObject).
  • Complete: All tasks succeeded.
  • Fail (500): Errors occurred; see messages.

Tentech 2024