Execute Workflow Block
What it does: Call and execute other published workflows from within your current workflow, enabling modular and reusable workflow design.
In simple terms: Execute Workflow is like calling a function in programming. Break complex workflows into smaller, reusable pieces, then call them when needed. Build once, use everywhere.
When to Use This
Use Execute Workflow when you need:
- ✅ Reuse common logic across multiple workflows
- ✅ Break complex workflows into manageable modules
- ✅ Maintain consistency across related workflows
- ✅ Update shared functionality in one place
- ✅ Create workflow libraries for your team
Example: Create a "Send Welcome Email" workflow once, then call it from signup, trial activation, and first purchase workflows.
Key Features
- Workflow Reusability: Build once, execute anywhere
- Variable Passing: Send data to the child workflow
- Response Handling: Get results back from executed workflow
- Published Workflows Only: Only stable, published workflows can be called
- Modular Design: Break complexity into manageable pieces
Setup Guide
Step 1: Create the Workflow to Execute
First, you need a published workflow to call:
- Build your reusable workflow (e.g., "Calculate Shipping Cost")
- Add variables that will receive input data
- Configure the workflow to produce output
- Publish the workflow - Only published workflows can be executed
- Test it works correctly
Step 2: Configure Execute Workflow Block
In your main workflow:
-
Select Workflow: Choose from published workflows
- Dropdown shows all published workflows in your workspace
- Only displays workflows with status "PUBLISHED"
- Select the workflow you want to execute
-
Save Answer: Choose where to store the workflow's result
- Select a variable to receive the response
- This variable will contain whatever the child workflow returns
- Optional: Leave empty if you don't need the result
-
Variable Mappings: Pass data to the child workflow
- Map your bot variables to the child workflow's variables
- Workflow variable: Select from child workflow's variables
- Variable value: Enter the value or use bot variables
- Add multiple mappings to pass multiple values
Configuration Example
Scenario: Reusable Discount Calculator
Child Workflow ("Calculate Discount"):
- Name: Calculate Discount
- Status: PUBLISHED
- Variables:
original_price(receives value)discount_percent(receives value)discount_result(returns result)
Parent Workflow (Shopping Cart):
- Execute Workflow Block Settings:
- Select Workflow: "Calculate Discount"
- Save Answer:
{{final_price}} - Variable Mappings:
- Workflow variable:
original_price→ Value:{{cart_total}} - Workflow variable:
discount_percent→ Value:{{user_discount}}
- Workflow variable:
Flow:
- User adds items to cart →
{{cart_total}}= 150 - User applies discount code →
{{user_discount}}= 20 - Execute Workflow block calls "Calculate Discount"
- Passes cart_total (150) to original_price
- Passes user_discount (20) to discount_percent
- Gets result back in
{{final_price}}= 120
Variable Mapping Explained
How It Works
Variable Mapping connects bot variables to workflow variables:
Your Workflow Variable → Child Workflow Variable
{{current_value}} → input_parameterMapping Types
1. Direct Value:
Workflow variable: email_address
Variable value: user@example.com2. From Bot Variable:
Workflow variable: customer_name
Variable value: {{user_name}}3. From Previous Step:
Workflow variable: calculated_total
Variable value: {{previous_block_output}}4. Combined/Formatted:
Workflow variable: full_message
Variable value: Hello {{user_name}}, your total is {{cart_total}}Common Use Cases
Shared Email Templates
Create reusable email sending workflows:
Child Workflow - "Send Welcome Email":
- Variables: recipient_email, recipient_name
- Logic: Format email, call send email block
- Published and ready
Usage in Multiple Workflows:
- Signup workflow → Execute "Send Welcome Email"
- Trial Started → Execute "Send Welcome Email"
- Account Activated → Execute "Send Welcome Email"
Benefits:
- Update email template once
- Consistent messaging everywhere
- Easy to maintain
Complex Calculations
Centralize business logic:
Child Workflow - "Calculate Tax":
- Variables: amount, state, item_type
- Logic: Tax rules by state and item type
- Returns: tax_amount, total_with_tax
Usage:
- Shopping Cart → Execute "Calculate Tax"
- Invoice Generation → Execute "Calculate Tax"
- Quote Creator → Execute "Calculate Tax"
Benefits:
- Tax logic in one place
- Easy to update rates
- Guaranteed consistency
Data Validation
Reusable validation logic:
Child Workflow - "Validate User Data":
- Variables: email, phone, address
- Logic: Check formats, verify data
- Returns: is_valid, error_messages
Usage:
- Registration Form → Execute "Validate User Data"
- Profile Update → Execute "Validate User Data"
- Checkout Process → Execute "Validate User Data"
API Integration Wrapper
Wrap external API calls:
Child Workflow - "Fetch Weather":
- Variables: city, units
- Logic: Call weather API, format response
- Returns: temperature, conditions, forecast
Usage:
- Travel Bot → Execute "Fetch Weather"
- Event Planner → Execute "Fetch Weather"
- Daily Briefing → Execute "Fetch Weather"
Benefits:
- API credentials in one place
- Error handling centralized
- Easy to switch weather providers
Multi-Step Process
Break down complex workflows:
Main Workflow - "Complete Order":
- Execute "Validate Cart"
- Execute "Calculate Total"
- Execute "Process Payment"
- Execute "Create Invoice"
- Execute "Send Confirmation"
Benefits:
- Each step is testable independently
- Easy to debug
- Clear workflow organization
- Reusable components
Advanced Patterns
Conditional Execution
Execute workflows based on conditions:
If {{user_type}} = "premium"
→ Execute "Premium Checkout"
Else
→ Execute "Standard Checkout"Sequential Execution
Chain multiple workflow executions:
1. Execute "Validate Data" → {{is_valid}}
2. If {{is_valid}} = true
→ Execute "Process Request" → {{result}}
3. If {{result}} = "success"
→ Execute "Send Notification"Nested Workflows
Workflows can call other workflows:
Workflow A → Execute Workflow B
Workflow B → Execute Workflow C
Workflow C → Returns to B
Workflow B → Returns to ANote: Be careful with nesting depth to avoid complexity.
Best Practices
Workflow Design
- Single Responsibility - Each child workflow should do one thing well
- Clear Naming - Use descriptive workflow names like "Send-Welcome-Email"
- Document Variables - Name variables clearly (recipient_email vs email1)
- Keep It Simple - Don't make child workflows too complex
- Test Independently - Ensure child workflows work alone first
Variable Management
- Consistent Naming - Use same conventions across workflows
- Required vs Optional - Document which variables are required
- Default Values - Provide defaults when appropriate
- Validation - Validate inputs in child workflow
- Clear Outputs - Return predictable, well-formatted results
Error Handling
- Graceful Failures - Child workflows should handle errors
- Return Status - Include success/error status in results
- Error Messages - Return helpful error descriptions
- Fallback Logic - Have backup plans for failures
- Logging - Log executions for debugging
Performance
- Avoid Deep Nesting - Limit workflow call depth
- Cache Results - Store results if called multiple times
- Minimize Calls - Combine operations when possible
- Async When Possible - Don't wait if you don't need the result
- Monitor Execution Time - Track how long child workflows take
Troubleshooting
| Problem | Likely Cause | Solution |
|---|---|---|
| Workflow not in dropdown | Not published | Publish the workflow you want to call |
| Variables not mapping | Wrong variable names | Check exact variable names in child workflow |
| No result returned | No save variable set | Select a variable in "Save Answer" |
| Wrong values passed | Incorrect mapping | Verify variable mappings are correct |
| Workflow fails | Child workflow error | Test child workflow independently |
| Slow execution | Inefficient child workflow | Optimize the child workflow |
What You Get Back
After executing a workflow:
-
Workflow Result: Whatever the child workflow returns
- Could be text, numbers, JSON, etc.
- Depends on how child workflow is configured
- Stored in the variable you selected in "Save Answer"
-
Execution Status: Success or failure
- If failed, check child workflow logs
- Errors propagate to parent workflow
Tips for Success
- Plan Your Structure - Design workflow hierarchy upfront
- Start Small - Begin with simple reusable workflows
- Test Thoroughly - Test child workflows independently
- Document Everything - Describe what each workflow does
- Use Version Control - Keep track of workflow changes
- Monitor Usage - Track which workflows are most reused
- Refactor Regularly - Improve and optimize over time
- Share with Team - Create libraries of useful workflows
Example: Building a Workflow Library
Core Workflows (Publish these):
- "Send-Email" - Reusable email sender
- "Validate-Email" - Email format checker
- "Calculate-Shipping" - Shipping cost calculator
- "Format-Currency" - Money formatter
- "Log-Event" - Event logging
Feature Workflows (Use the core workflows):
- "User-Signup" → Uses: Send-Email, Validate-Email, Log-Event
- "Checkout" → Uses: Calculate-Shipping, Format-Currency, Send-Email
- "Profile-Update" → Uses: Validate-Email, Log-Event
Benefits:
- Consistent behavior across features
- Easy maintenance
- Rapid development
- Clear architecture
Execute Workflow is essential for building scalable, maintainable workflow systems!