Skip to main content

Overview

The On Task Created automation event triggers immediately after a task is created with the selected Flow. This event captures the moment when a new task enters the system, allowing you to automate subsequent workflows, send notifications, or integrate with external systems right at the point of task creation.

When Does This Event Trigger?

The “On Task Created” event is triggered when:
  1. A task is created through any of these methods:
    • Web - Manual task creation via the web interface
    • Excel Upload - Bulk task import from spreadsheet
    • Mobile App - Task creation from MileApp Field mobile app
    • API - Task creation via MileApp API endpoints
    • Automation - Task created by another automation rule
    • Scheduled Task - Recurring task generation from schedules
  2. The task is successfully saved to the system
  3. The task’s Flow matches the Flow selected in the automation configuration
Important: The automation will only trigger if the task’s Flow matches the Flow specified in the automation settings. This allows you to create Flow-specific automation rules.

Prerequisites

Before setting up an automation with this event, ensure:
  1. You have access to the Automation feature in MileApp
  2. You have appropriate permissions to create and manage automations
  3. You have at least one Flow configured in your organization
  4. You understand which Flow you want to monitor for new tasks
Required permission:
  • View Automation
  • Create Automation

Use Cases

1. Automatic Task Chaining

Scenario: When a “Pickup” task is created, automatically create a corresponding “Delivery” task. Configuration:
  • Event: On Task Created
  • Flow: Pickup
  • Automation Type: Create Task
  • Action: Create new task with Flow “Delivery” linked to the original pickup task
Benefit: Ensures paired pickup-delivery workflows are always created together

2. External System Synchronization

Scenario: Sync task creation to external ERP, WMS, or CRM systems. Configuration:
  • Event: On Task Created
  • Flow: Customer Visit
  • Automation Type: Webhook
  • Action: Send task data to CRM to update customer interaction records
Benefit: Unified data across multiple business systems

3. Customer Notification on Task Creation

Scenario: Automatically notify customers when their delivery or service task is created. Configuration:
  • Event: On Task Created
  • Flow: Delivery
  • Automation Type: Webhook
  • Action: Send task confirmation and tracking details to customer via email or SMS
Benefit: Keeps customers informed about their order status from the moment it enters the system

Setting Up On Task Created Automation

Step 1: Navigate to Automation Settings

  1. Log in to MileApp web
  2. Click on Flow in the main navigation
  3. Click on the Automation tab
Automation Tab

Automation tab in Flow menu

Step 2: Create New Automation

  1. Click the New button in the Automation page
  2. The “Create Automation” dialog will appear
Create Automation Dialog

Create Automation dialog with event selection showing all available automation events

Step 3: Configure Automation Details

Fill in the following information:
  1. Automation Name: Provide a descriptive name (e.g., “Create Delivery Task on Pickup Creation”)
  2. Event: Select “On Task Created” from the dropdown
  3. Flow: Select the Flow you want to monitor (e.g., “Pickup”, “Delivery”, “Visit”)
  4. Automation Type: Choose the action type:
    • Create Task
    • Create and Assign Task
    • Move Task
    • Assign Task
    • Webhook
    • Notification
  5. Configure type-specific settings based on your chosen Automation Type

Step 4: Configure Rules (Optional)

Add conditional rules to control when the automation should execute:
  • Filter by specific users or teams
  • Apply conditions based on hub or location
  • Set task field conditions (e.g., priority, status)
  • Filter by time of day or day of week

Step 5: Save and Activate

  1. Click Submit to create the automation
  2. Ensure the automation is set to Active (toggle enabled)
  3. Test the automation by creating a task with the selected Flow

Webhook Integration Details

This section applies only if you’re using the Webhook automation type.

Payload Structure

When “On Task Created” triggers a webhook, MileApp sends a POST request with the following data structure:
{
  "event": "on_task_created",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "task": {
    "id": "task_id_123",
    "flow": "Delivery",
    "flowId": "flow_id_456",
    "invoice": "INV-2024-001",
    "name": "John Doe",
    "phone": "+6281234567890",
    "address": "Jl. Sudirman No. 123, Jakarta",
    "deliveryCoordinate": "-6.2088,106.8456",
    "startTime": "2024-01-15T14:00:00.000Z",
    "endTime": "2024-01-15T16:00:00.000Z",
    "status": "unassigned",
    "priority": "normal",
    "paymentType": ["COD"],
    "customFields": {
      "notes": "Handle with care",
      "specialInstructions": "Call before delivery"
    }
  },
  "hub": {
    "id": "hub_id_789",
    "name": "Jakarta Hub"
  },
  "creator": {
    "id": "user_id_101",
    "name": "Operations Manager",
    "email": "ops@company.com"
  },
  "createdFrom": "WEB"
}
Note: The exact payload structure may vary based on your Flow configuration and the fields defined in your Flow components.

Flow Matching Behavior

The Flow Matching is a critical aspect of the On Task Created automation:

How It Works

  1. Automation Configuration - You select a specific Flow when creating the automation (e.g., “Delivery”)
  2. Task Creation - A task is created with a Flow assignment (e.g., “Pickup” or “Delivery”)
  3. Match Check - MileApp compares the task’s Flow with the automation’s Flow
  4. Trigger Decision:
    • Match - If they match, the automation executes
    • No Match - If they don’t match, the automation is skipped

Example Scenario

Automation Setup:
  • Event: On Task Created
  • Flow: Delivery
  • Action: Send webhook to external system
Task Creation Results:
  • Task created with Flow “Delivery” → ✅ Automation TRIGGERS
  • Task created with Flow “Pickup” → ❌ Automation DOES NOT TRIGGER
  • Task created with Flow “Visit” → ❌ Automation DOES NOT TRIGGER

Multiple Automations

You can create multiple automations with the same event but different Flows:
  1. Automation 1: On Task Created → Flow: Delivery → Send to ERP
  2. Automation 2: On Task Created → Flow: Pickup → Send to WMS
  3. Automation 3: On Task Created → Flow: Visit → Send to CRM
Each automation operates independently and only triggers for tasks matching its configured Flow.

Monitoring and Troubleshooting

Viewing Automation Logs

To verify your “On Task Created” automation is working correctly:
  1. Go to Flow > Automation
  2. Find your automation in the list
  3. Click the clock history icon to view execution logs
  4. Review successful executions and any errors

Common Issues

Issue: Automation not triggering when tasks are created Possible Causes:
  • Automation is not set to Active
  • Task’s Flow does not match automation’s Flow configuration
  • Rules/filters exclude the created tasks
  • User creating task doesn’t have proper permissions
  • Automation has syntax errors in webhook URL or configuration
Solution:
  • Verify automation is enabled (toggle is ON)
  • Check that task Flow matches automation Flow setting
  • Review rules to ensure they don’t overly restrict triggering
  • Verify user permissions for task creation
  • Check automation logs for error messages
Issue: Webhook receiving incomplete task data Possible Causes:
  • Flow has optional fields that weren’t filled during task creation
  • Custom fields not properly configured in Flow
  • Task created via API with minimal data
Solution:
  • Review Flow configuration to identify required vs optional fields
  • Implement validation in webhook endpoint to handle missing data
  • Add default values for optional fields in automation
Issue: Automation triggering multiple times for same task Possible Causes:
  • Multiple automations configured for the same Flow
  • Task update events being confused with task creation
  • Webhook endpoint not responding with proper status code
Solution:
  • Review all active automations to identify duplicates
  • Ensure you’re using “On Task Created” not “On Task Finished”
  • Implement idempotency in webhook endpoint using task ID
Issue: Duplicate tasks being created by automation Possible Causes:
  • Automation configured to create task triggers itself recursively
  • Multiple automations creating tasks in a loop
  • No safeguards against duplicate task creation
Solution:
  • Ensure created tasks use different Flow than trigger Flow
  • Add rules to prevent automation loops
  • Implement duplicate detection logic in automation or webhook

Frequently Asked Questions

Q: Can I create automation for multiple Flows at once? A: No, each automation can only monitor one Flow. To handle multiple Flows, create separate automations for each Flow. Q: What happens if I create a task via API without specifying a Flow? A: Tasks must have a Flow assigned. If no Flow is specified, the task creation will fail. Q: Does the automation trigger if task creation fails? A: No, the automation only triggers when the task is successfully saved to the system. Q: How quickly does the automation trigger after task creation? A: Typically within seconds. Exact timing depends on system load and webhook endpoint response time. Q: Can I see which automation created a task? A: Yes, check the task’s creation details or the automation log to trace which automation created a task. Q: Can I filter automations to trigger only for tasks created by specific users? A: Yes, use the Rules configuration to filter by creator, hub, team, or other criteria. Q: Does bulk task import (Excel upload) trigger automation for each task? A: Yes, the automation triggers for each task created during bulk import.