Skip to content

Workflow Operation

The Workflow operation enables triggering workflows from the Executor service. This operation type is ideal for automatically starting workflows in response to events, webhooks, or scheduled tasks.

For more details on workflows, refer to the Workflow Service documentation.

Configuration Example

typescript
import { createWorkflow, createExecutor } from "@tailor-platform/sdk";
import { order } from "./types";

const processOrderWorkflow = createWorkflow({
  name: "process-order",
  steps: [
    // workflow steps...
  ],
});

createExecutor({
  name: "workflow-executor",
  description: "Trigger workflow execution",
  // Choose one of the trigger types:
  // trigger: recordCreatedTrigger({ type: order }),
  // trigger: webhookTrigger(),
  // trigger: scheduleTrigger({ cron: "0 * * * *" }),
  operation: {
    kind: "workflow",
    workflow: processOrderWorkflow,
    args: ({ newRecord }) => ({
      orderId: newRecord.id,
      timestamp: new Date().toISOString(),
    }),
  },
});

Properties

Executor Properties

PropertyTypeRequiredDescription
namestringYesThe name of the executor. The name field has the validation rule ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$, and it does not allow capital letters
descriptionstringNoThe description of the executor
triggerobjectYesThe type of trigger (e.g., recordCreatedTrigger, webhookTrigger, scheduleTrigger)

Workflow Operation Properties

PropertyTypeRequiredDescription
kind"workflow"YesSpecifies this is a workflow operation
workflowWorkflowYesThe workflow to trigger (created with createWorkflow())
argsfunctionNoA function that returns the arguments to pass to the workflow. Receives trigger context (e.g., newRecord, oldRecord)

Executor Properties

PropertyTypeRequiredDescription
namestringYesThe name of the executor. The name field has the validation rule ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$, and it does not allow capital letters
workspace_idstringYesThe ID of the workspace that the executor namespace belongs to
descriptionstringNoThe description of the executor
triggerobjectYesThe type of trigger (webhook, event, or schedule)

Workflow Operation Properties

PropertyTypeSupports ScriptingRequiredDescription
workflow_namestring-YesThe name of the workflow to trigger
invokerobject-NoThe invoker of the operation
variablesstringJavaScript / CELNoThe variables to pass to the workflow. Can access trigger-specific data via args object

Learn more about executor properties in the Tailor Platform Provider documentation.

Executor Properties

PropertyTypeRequiredDescription
NamestringYesThe name of the executor. The name field has the validation rule ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$, and it does not allow capital letters
DescriptionstringNoThe description of the executor
TriggerobjectYesThe type of trigger (e.g., #TriggerIncomingWebhook, #TriggerEvent, #TriggerSchedule)

TargetWorkflow Properties

PropertyTypeSupports ScriptingRequiredDescription
WorkflowNamestring-YesThe name of the workflow to trigger
Invokerobject-NoThe invoker of the operation
VariablesstringJavaScript / CELNoThe variables to pass to the workflow. Can access trigger-specific data via args object

Use Cases

Workflow operations are ideal for:

  • Event-driven automation: Automatically trigger workflows when database records are created, updated, or deleted
  • Webhook processing: Start workflows in response to external webhooks from third-party services
  • Scheduled workflows: Execute workflows on a regular schedule (e.g., daily reports, periodic data synchronization)
  • Microservices orchestration: Coordinate complex business processes across multiple services
  • Long-running processes: Handle tasks that require multiple steps or extended processing time
  • Asynchronous task processing: Trigger workflows for background processing without blocking the main request