Creating & Managing Rules

How to create, edit, and manage automation rules in OmniOrders using the visual Flow Editor.

---
title: "Creating & Managing Rules"
description: How to create, edit, and manage automation rules in OmniOrders using the visual Flow Editor.
---

This page covers creating rules (from scratch or from a template), using the Flow Editor, and managing the rules you already have.

## Creating a New Rule

There are two ways to create a rule: start from scratch by picking a trigger, or start from a pre-built template.

### Option A: Start from Scratch

<Steps>

1. **Open the Rules page**

   Go to **Automation > Rules** from the sidebar.

2. **Click "+ New rule"**

   The **New Rule** dialog appears with available triggers.

   <img src="/screenshots/rules-trigger-selection.png" alt="Trigger Selection Dialog" style="max-width: 560px; width: 100%; border-radius: 8px; border: 1px solid var(--sl-color-gray-5);" />

3. **Pick a trigger**

   Choose the event that should start your rule. Use the category chips (**All**, **Orders**, **Inventory**, **Purchase Orders**) to filter triggers.

   The most common trigger is **Before Import Order**, which runs before an order is imported from a sales channel and supports the widest range of actions.

4. **Build your rule in the Flow Editor**

   The Flow Editor opens where you can add actions and conditions. See [Using the Flow Editor](#using-the-flow-editor) below.

</Steps>

### Option B: Start from a Template

<img src="/screenshots/rules-templates.png" alt="Templates section with pre-built rules organized by category" style="max-width: 720px; width: 100%; border-radius: 8px; border: 1px solid var(--sl-color-gray-5);" />

<Steps>

1. **Scroll to the Templates section**

   On the Rules page, scroll down past "Your Rules" to see the **Templates** section.

2. **Browse or search templates**

   Use the search bar or filter by category (**All templates**, **Order Routing**, **Order Modification**, etc.) to find a template that matches your use case.

3. **Click a template card**

   A preview dialog opens showing the template steps, trigger type, and a description of what it does.

4. **Click "Create Rule"**

   The Flow Editor opens with the template's trigger and steps pre-configured. You can customize everything from there.

</Steps>

:::tip[When to use templates]
Templates save time for common setups like routing to a specific warehouse or sending order confirmation emails. You can modify everything after creation.
:::

## Using the Flow Editor

The Flow Editor is where you build and wire up your rule. It's a drag-and-drop canvas with a sidebar of available actions on the left.

<img src="/screenshots/rules-flow-editor.png" alt="Flow Editor with action sidebar and visual flow canvas" style="max-width: 720px; width: 100%; border-radius: 8px; border: 1px solid var(--sl-color-gray-5);" />

### Editor Layout

The editor has three main areas:

- **Top toolbar** — Rule name (editable), undo/redo, zoom controls, fit-to-view, auto-arrange, **Validate**, **Preview**, and **Save**
- **Action sidebar** (left) — Lists all available actions grouped by category. Click or drag an action to add it to the canvas
- **Canvas** (center) — The visual workspace where you build and connect your flow

### Action Sidebar Categories

Actions in the sidebar are grouped by category:

<CardGrid>
  <IconCard title="Conditions" icon="help-circle" bgColor="#fffbeb" bgColorDark="rgba(251, 191, 36, 0.12)">
    Add IF / THEN / ELSE branching logic. Check order fields like total, country, SKU, or tags — then run different actions based on the result.
  </IconCard>

  <IconCard title="Routing" icon="route" bgColor="#faf5ff" bgColorDark="rgba(168, 85, 247, 0.12)">
    Route to Warehouse, Route by Inventory, Closest Warehouse, Route by ZIP Code, Route by SKU, and Address Match.
  </IconCard>

  <IconCard title="Modify Order" icon="pencil" bgColor="#fffbeb" bgColorDark="rgba(251, 191, 36, 0.12)">
    Change Shipping Method, Change Shipping Details, Change Order Status, Modify Order Data, Add Charge / Discount, Add SKUs to Order, and Find & Replace.
  </IconCard>

  <IconCard title="Notifications" icon="bell" bgColor="#f0fdf4" bgColorDark="rgba(34, 197, 94, 0.12)">
    Send Email with customizable templates and recipients.
  </IconCard>

  <IconCard title="HTTP Request" icon="globe" bgColor="#eff6ff" bgColorDark="rgba(59, 130, 246, 0.12)">
    Webhook / HTTP Request to send data to external systems.
  </IconCard>

  <IconCard title="Inventory" icon="package" bgColor="#fefce8" bgColorDark="rgba(234, 179, 8, 0.12)">
    Select Warehouses to control which locations push inventory data to a sales channel.
  </IconCard>
</CardGrid>

### Building a Flow

Here's what a more complex rule looks like in practice:

<img src="/screenshots/rules-flow-example.png" alt="Flow Editor Example — a rule with conditions, routing, modifications, and notifications" style="max-width: 560px; width: 100%; border-radius: 8px; border: 1px solid var(--sl-color-gray-5);" />

This rule adds SKUs to the order, then checks inventory. If stock exists, it routes to the closest warehouse; if not, it sends to a specific one. Error paths trigger email notifications. A second condition branch handles additional logic further down.

<Steps>

1. **Add an action from the sidebar**

   Click any action in the sidebar to add it to the canvas, or drag it to a specific position.

2. **Connect nodes**

   Drag from an output handle on one node to the input handle on the next. The connections set the execution order.

3. **Configure each action**

   Click a node on the canvas to open its configuration panel. Fill in the required fields (e.g., select a warehouse for "Route to Warehouse", enter email recipients for "Send Email").

4. **Add conditions (optional)**

   Click **Condition** in the sidebar to add IF / THEN / ELSE logic. Connect the THEN branch to one set of actions and the ELSE branch to another.

5. **Validate your rule**

   Click **Validate** in the toolbar to check for errors. The editor will highlight any missing connections or configurations.

6. **Preview your rule**

   Click **Preview** to simulate how your rule would process a sample order. Worth doing before you activate anything.

7. **Save your rule**

   Click **Save** to save your rule. You can choose to:
   - **Save & Activate** — Save and immediately start running the rule
   - **Save as Draft** — Save without activating (rule stays disabled)

</Steps>

### Toolbar Controls

| Control | Description |
|---------|-------------|
| **Rule name** | Click the pencil icon next to the name to rename your rule |
| **Undo / Redo** | Reverse or replay your last changes (Ctrl+Z / Ctrl+Y) |
| **Zoom controls** | Zoom in, zoom out, or fit the entire flow to view |
| **Auto-arrange** | Automatically reposition all nodes for a clean layout |
| **Validate** | Check the flow for errors and missing configurations |
| **Preview** | Simulate the flow with sample data to verify the logic |
| **Save** | Save the rule and optionally activate it |

## Managing Existing Rules

### Enabling and Disabling Rules

Each rule has a **toggle switch** on the right side of its card. Flip it to turn a rule on or off.

- **Active** — Green dot next to the name. The rule runs when its trigger fires.
- **Disabled** — "Disabled" label. The rule is saved but does not run.

:::caution[Integration-Linked Rules]
Rules linked to active integrations cannot be deactivated from the toggle. You need to unlink the rule from the integration first.
:::

### Editing a Rule

Click the **pencil icon** or click directly on the rule name/description to open it in the Flow Editor. Make your changes and click **Save**.

### Deleting a Rule

Click the **trash icon** on the rule card. You'll get a confirmation dialog before anything is deleted.

:::note[Last Rule Protection]
If a rule is the only one in its trigger category, the delete button is disabled. This prevents accidentally removing the only rule handling that trigger.
:::

### Searching and Filtering

Use the controls at the top of the "Your Rules" section:

- **Search bar** — Type to filter rules by name
- **Category dropdown** — Filter by trigger type (shows "All rules" by default)
- **Status dropdown** — Show only "Active" or "Disabled" rules (shows "All statuses" by default)
- **Sort dropdown** — Order by "Newest first" (default), "Oldest first", "Name A–Z", or "Name Z–A"

The rule count at the bottom updates to show "Showing X of Y" when filters are active.

## Understanding Rule Priority

When multiple active rules share the same trigger, the primary rule runs first. That rule gets a **"Default"** badge in the list so you know which one takes priority.

:::tip[Rule Ordering]
The rule marked as **Default** is the primary rule for its trigger event and runs first. Deactivate rules you don't want to run.
:::

## Best Practices

<CardGrid>
  <IconCard title="Start simple" icon="target">
    One action per rule at first. Once it works, layer on conditions and extra actions.
  </IconCard>

  <IconCard title="Preview before activating" icon="eye">
    Click Preview to test with sample data before turning a rule on. Catches config mistakes before they hit real orders.
  </IconCard>

  <IconCard title="Name rules clearly" icon="tag">
    "Route US orders to Miami warehouse" is better than "New Rule". You'll thank yourself when you have 20 rules in the list.
  </IconCard>

  <IconCard title="Save as draft first" icon="pause-circle">
    Save new rules disabled. Test with a sample order, then activate once it's doing what you expect.
  </IconCard>
</CardGrid>

## Common Use Cases

### Route Orders to a Specific Warehouse

Use the **Before Import Order** trigger with a **Route to Warehouse** action. Select the destination warehouse in the action configuration.

### Route by Customer Location

Add a **Condition** node to check the customer's state, ZIP code, or country. Connect different **Route to Warehouse** actions to the THEN and ELSE branches.

### Add Free Gift for High-Value Orders

Use a **Condition** to check if the order total is above a threshold. If true, use **Add SKUs to Order** to insert a gift product, then route the order.

### Send Confirmation Email on Import

Add a **Send Email** action after the trigger. Configure the template, subject line, and recipients in the action panel.

### Control Inventory Sync

Use the **Inventory Sync** trigger with a **Select Warehouses** action. Only the warehouses you select will push inventory to the sales channel.

### Webhook to External System

Use the **PO Complete** or **PO In Transit** trigger with a **Webhook / HTTP Request** action. Configure the URL, headers, and the fields you want to send.

## Troubleshooting

<CardGrid>
  <IconCard title="Rule not running" icon="alert-circle">
    Make sure the rule is **Active** (green dot). Also check the trigger: "Before Import Order" only fires on sales channel imports, not manual order creation.
  </IconCard>

  <IconCard title="Validation errors" icon="x-circle">
    Click **Validate** in the Flow Editor. Usually it's an unconnected node, an empty action config, or a missing warehouse selection.
  </IconCard>

  <IconCard title="Can't deactivate a rule" icon="lock">
    The toggle won't work if the rule is linked to an integration. Unlink it from **Integrations** first.
  </IconCard>

  <IconCard title="Can't delete a rule" icon="shield">
    Delete is disabled when it's the only rule for that trigger. Create another rule for the same trigger first, or just deactivate this one.
  </IconCard>
</CardGrid>

**Related pages:**
- [Rules & Automation Overview](/automation/overview/)
- [Integrations Overview](/integrations/overview/)
- [Warehouses Management](/warehouses/overview/)
Copied to clipboard!