Skip to main content
Arcanflows

Workflow Integration

Connect forms to workflows for automated processing and complex business logic.

Overview

Integrate forms with Arcanflows workflows to trigger automated processes, route submissions, and execute complex business logic based on form data.

Integration Methods

Direct Trigger

Form submission directly triggers a workflow:

User submits form → Workflow starts → Nodes execute → Complete

Conditional Trigger

Workflow triggers based on submission conditions:

User submits form → Conditions evaluated → Matching workflow(s) triggered

Scheduled Processing

Forms collected, workflows run on schedule:

Submissions collected → Scheduled time → Batch workflow processing

Basic Configuration

Simple Trigger

json
{
  "workflowIntegration": {
    "enabled": true,
    "workflowId": "workflow_abc123",
    "trigger": "on_submit"
  }
}

With Data Mapping

json
{
  "workflowIntegration": {
    "workflowId": "lead_processing",
    "trigger": "on_submit",
    "inputMapping": {
      "customerName": "{{firstName}} {{lastName}}",
      "customerEmail": "{{email}}",
      "companyName": "{{company}}",
      "leadSource": "contact_form",
      "submittedAt": "{{_submittedAt}}"
    }
  }
}

Multiple Workflows

json
{
  "workflowIntegration": {
    "workflows": [
      {
        "workflowId": "crm_update",
        "trigger": "on_submit",
        "priority": 1
      },
      {
        "workflowId": "send_confirmation",
        "trigger": "on_submit",
        "priority": 2,
        "async": true
      },
      {
        "workflowId": "sales_notification",
        "trigger": "on_submit",
        "condition": "{{leadScore}} >= 80"
      }
    ]
  }
}

Conditional Triggers

Based on Field Values

json
{
  "workflowIntegration": {
    "workflows": [
      {
        "workflowId": "sales_inquiry",
        "condition": {
          "field": "inquiryType",
          "operator": "equals",
          "value": "sales"
        }
      },
      {
        "workflowId": "support_ticket",
        "condition": {
          "field": "inquiryType",
          "operator": "equals",
          "value": "support"
        }
      },
      {
        "workflowId": "general_inquiry",
        "condition": {
          "field": "inquiryType",
          "operator": "in",
          "value": ["general", "other"]
        }
      }
    ]
  }
}

Complex Conditions

json
{
  "workflowIntegration": {
    "workflows": [
      {
        "workflowId": "enterprise_sales",
        "condition": {
          "logic": "and",
          "rules": [
            { "field": "companySize", "operator": "greaterThan", "value": 500 },
            { "field": "budget", "operator": "greaterThan", "value": 50000 }
          ]
        }
      },
      {
        "workflowId": "smb_sales",
        "condition": {
          "logic": "or",
          "rules": [
            { "field": "companySize", "operator": "lessThan", "value": 50 },
            { "field": "budget", "operator": "lessThan", "value": 10000 }
          ]
        }
      }
    ]
  }
}

Expression-Based

json
{
  "workflowIntegration": {
    "workflows": [
      {
        "workflowId": "high_priority",
        "conditionExpression": "{{priority}} === 'urgent' || {{revenue}} > 100000"
      },
      {
        "workflowId": "follow_up",
        "conditionExpression": "{{contactPreference}} === 'phone' && {{phone}} !== ''"
      }
    ]
  }
}

Data Mapping

Field Mapping

json
{
  "workflowIntegration": {
    "inputMapping": {
      "name": "{{firstName}} {{lastName}}",
      "email": "{{email}}",
      "phone": "{{phone}}",
      "message": "{{message}}",
      "metadata": {
        "formId": "{{_formId}}",
        "submissionId": "{{_submissionId}}",
        "timestamp": "{{_submittedAt}}",
        "ip": "{{_ipAddress}}",
        "userAgent": "{{_userAgent}}"
      }
    }
  }
}

Transform Data

json
{
  "workflowIntegration": {
    "inputMapping": {
      "fullName": "upper({{firstName}}) + ' ' + upper({{lastName}})",
      "normalizedEmail": "lower(trim({{email}}))",
      "budgetNumber": "parseInt({{budget}})",
      "tags": "split({{interests}}, ',')"
    }
  }
}

Nested Objects

json
{
  "workflowIntegration": {
    "inputMapping": {
      "contact": {
        "name": "{{firstName}} {{lastName}}",
        "email": "{{email}}",
        "phone": "{{phone}}"
      },
      "company": {
        "name": "{{companyName}}",
        "size": "{{companySize}}",
        "industry": "{{industry}}"
      },
      "request": {
        "type": "{{inquiryType}}",
        "message": "{{message}}",
        "priority": "{{priority}}"
      }
    }
  }
}

Include All Fields

json
{
  "workflowIntegration": {
    "inputMapping": {
      "_includeAllFields": true,
      "_additionalData": {
        "source": "website_form",
        "campaign": "summer_2025"
      }
    }
  }
}

Execution Modes

Synchronous

Wait for workflow completion:

json
{
  "workflowIntegration": {
    "workflowId": "process_order",
    "executionMode": "sync",
    "timeout": 30000,
    "onSuccess": {
      "redirect": "/order-confirmed?id={{workflowOutput.orderId}}"
    },
    "onError": {
      "showMessage": "Order processing failed. Please try again."
    }
  }
}

Asynchronous

Fire and forget:

json
{
  "workflowIntegration": {
    "workflowId": "send_notifications",
    "executionMode": "async",
    "onQueued": {
      "showMessage": "Your request is being processed.",
      "redirect": "/thank-you"
    }
  }
}

Background with Callback

json
{
  "workflowIntegration": {
    "workflowId": "long_running_process",
    "executionMode": "background",
    "callback": {
      "webhookUrl": "https://your-app.com/workflow-complete",
      "includeOutput": true
    }
  }
}

Response Handling

Use Workflow Output

json
{
  "workflowIntegration": {
    "workflowId": "calculate_quote",
    "executionMode": "sync",
    "responseMapping": {
      "displayFields": {
        "quote": "{{workflowOutput.quoteAmount}}",
        "discount": "{{workflowOutput.discountApplied}}",
        "total": "{{workflowOutput.finalTotal}}"
      }
    },
    "onSuccess": {
      "showResult": true,
      "template": "<div class='quote-result'>...</div>"
    }
  }
}

Store Output

json
{
  "workflowIntegration": {
    "workflowId": "process_application",
    "storeOutput": {
      "enabled": true,
      "field": "workflow_result",
      "includeTimestamp": true
    }
  }
}

Conditional Actions

json
{
  "workflowIntegration": {
    "workflowId": "evaluate_lead",
    "executionMode": "sync",
    "responseActions": [
      {
        "condition": "{{workflowOutput.score}} >= 80",
        "action": "redirect",
        "config": { "url": "/schedule-demo" }
      },
      {
        "condition": "{{workflowOutput.score}} >= 50",
        "action": "redirect",
        "config": { "url": "/learn-more" }
      },
      {
        "condition": "{{workflowOutput.score}} < 50",
        "action": "showMessage",
        "config": { "message": "Thanks! We'll be in touch soon." }
      }
    ]
  }
}

Error Handling

Retry Configuration

json
{
  "workflowIntegration": {
    "workflowId": "critical_process",
    "errorHandling": {
      "retry": {
        "enabled": true,
        "maxAttempts": 3,
        "backoffMs": [1000, 5000, 15000]
      },
      "onMaxRetries": {
        "action": "queue",
        "notifyAdmin": true
      }
    }
  }
}

Fallback Workflow

json
{
  "workflowIntegration": {
    "workflowId": "primary_processor",
    "errorHandling": {
      "fallback": {
        "workflowId": "backup_processor",
        "condition": "error.code === 'WORKFLOW_TIMEOUT'"
      }
    }
  }
}

Error Messages

json
{
  "workflowIntegration": {
    "errorHandling": {
      "userMessages": {
        "WORKFLOW_NOT_FOUND": "Processing is temporarily unavailable.",
        "WORKFLOW_TIMEOUT": "Processing took too long. We'll follow up via email.",
        "VALIDATION_ERROR": "There was an issue with your submission.",
        "default": "Something went wrong. Please try again."
      }
    }
  }
}

Use Cases

Lead Routing

json
{
  "workflowIntegration": {
    "workflows": [
      {
        "workflowId": "route_to_sales",
        "condition": "{{leadType}} === 'sales'",
        "inputMapping": {
          "leadData": {
            "name": "{{fullName}}",
            "email": "{{email}}",
            "company": "{{company}}",
            "score": "{{calculatedScore}}"
          },
          "routing": {
            "region": "{{country}}",
            "productInterest": "{{product}}"
          }
        }
      }
    ],
    "onSuccess": {
      "updateSubmission": {
        "routedTo": "{{workflowOutput.assignedRep}}",
        "routedAt": "{{workflowOutput.timestamp}}"
      }
    }
  }
}

Order Processing

json
{
  "workflowIntegration": {
    "workflowId": "process_order",
    "executionMode": "sync",
    "inputMapping": {
      "customer": {
        "id": "{{customerId}}",
        "email": "{{email}}",
        "address": "{{shippingAddress}}"
      },
      "order": {
        "items": "{{cartItems}}",
        "paymentMethod": "{{paymentMethod}}",
        "couponCode": "{{coupon}}"
      }
    },
    "onSuccess": {
      "redirect": "/order-confirmation?orderId={{workflowOutput.orderId}}"
    },
    "onError": {
      "showMessage": "{{workflowOutput.errorMessage}}",
      "preserveFormData": true
    }
  }
}

Application Review

json
{
  "workflowIntegration": {
    "workflows": [
      {
        "workflowId": "initial_screening",
        "executionMode": "sync",
        "inputMapping": {
          "applicant": "{{_allFields}}",
          "position": "{{jobPosition}}"
        }
      },
      {
        "workflowId": "notify_hiring_manager",
        "condition": "{{workflowOutput.passedScreening}} === true",
        "executionMode": "async"
      },
      {
        "workflowId": "send_rejection",
        "condition": "{{workflowOutput.passedScreening}} === false",
        "executionMode": "async"
      }
    ]
  }
}

Approval Workflow

json
{
  "workflowIntegration": {
    "workflowId": "expense_approval",
    "executionMode": "sync",
    "inputMapping": {
      "requestor": "{{employeeId}}",
      "amount": "{{expenseAmount}}",
      "category": "{{expenseCategory}}",
      "description": "{{description}}",
      "receipts": "{{uploadedFiles}}"
    },
    "onSuccess": {
      "updateSubmission": {
        "status": "{{workflowOutput.status}}",
        "approver": "{{workflowOutput.approver}}",
        "approvedAt": "{{workflowOutput.timestamp}}"
      },
      "showMessage": "Your expense request has been {{workflowOutput.status}}."
    }
  }
}

Scheduling

Batch Processing

json
{
  "workflowIntegration": {
    "workflowId": "batch_processor",
    "scheduling": {
      "mode": "batch",
      "schedule": "0 9 * * 1-5",
      "batchSize": 100,
      "inputMapping": {
        "submissions": "{{_batchSubmissions}}"
      }
    }
  }
}

Delayed Trigger

json
{
  "workflowIntegration": {
    "workflowId": "follow_up",
    "scheduling": {
      "mode": "delayed",
      "delay": "24h",
      "condition": "{{status}} === 'pending'"
    }
  }
}

Monitoring

Execution Tracking

json
{
  "workflowIntegration": {
    "tracking": {
      "enabled": true,
      "logLevel": "detailed",
      "storeWith": "submission"
    }
  }
}

Notifications

json
{
  "workflowIntegration": {
    "notifications": {
      "onError": {
        "email": "[email protected]",
        "slack": "#workflow-alerts"
      },
      "onSuccess": {
        "condition": "{{workflowOutput.flagged}} === true",
        "slack": "#review-queue"
      }
    }
  }
}

Best Practices

  1. Use async for non-critical - Don't block form submission
  2. Map data explicitly - Clear input/output mapping
  3. Handle all errors - User-friendly error messages
  4. Set timeouts - Prevent indefinite waits
  5. Test thoroughly - All condition branches
  6. Monitor executions - Track success/failure rates
  7. Version workflows - Ensure backward compatibility