> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omnilinker.pl/llms.txt
> Use this file to discover all available pages before exploring further.

# Create and edit automations

> Start an automation from a goal or from scratch, choose its trigger, conditions and steps, check what it would do, and switch it on.

You need the **Create and change automations** permission to create or change an automation. With **See automations**
alone, you can open every automation but change nothing. See [Permissions](/automations/overview#permissions).

## Create an automation

<Steps>
  <Step title="Start a new automation">
    Open **Automations** > **Automations** and click **New automation**. The page **What should happen?** opens.
  </Step>

  <Step title="Pick a goal, or start blank">
    Goals are ready-made automations, grouped by what starts them. Each card shows its **When**, **if** and **then**.
    Click **Use this** on a goal to open the editor with it filled in, or click **Start blank** to build one yourself.
    See [Goals](#goals).
  </Step>

  <Step title="Fill in what only you know">
    A goal leaves your own values empty, such as the status to set or the courier service. Choose them in the editor.
  </Step>

  <Step title="Name it">
    Type a name at the top, for example "Ship paid parcel-locker orders". Optionally choose a **Group**, and click
    **Add a note for your team** to say why it exists and who to ask.
  </Step>

  <Step title="Check it">
    Look at **What it would do** on the right, and try it on an order. See
    [Check before you switch it on](#check-before-you-switch-it-on).
  </Step>

  <Step title="Choose whether it runs, and create it">
    Under **Whether it runs**, choose **Off**, **Trial** or **On**, then click **Create**. A new automation is **Off**
    until you choose otherwise.
  </Step>
</Steps>

### Goals

You can search the goals by their words, for example "unpaid" or "stuck". The goals come from the modules your
organization uses:

| Goal | When | If | Then |
| - | - | - | - |
| **Sort orders by where they came from** | an order arrives | the source is one you choose | set a matching status |
| **Flag big orders** | an order arrives | the total is at least an amount you choose | raise the priority and tell the warehouse |
| **Send paid orders to packing** | an order is paid in full | | set the status your packers work from |
| **Ship paid orders** | an order is paid in full | it has no shipment yet | create the shipment, print the label, set the status |
| **Chase unpaid orders** | an order has sat in a status for 3 days | it isn't paid | tell the team and move it to the status you choose |
| **Catch orders that got stuck** | an order has sat in one status for 2 days | | tell the operations lead |
| **Packed: print the label and ship** | a packer presses "Packed" or scans its barcode | | create the shipment, print the label at that station, set the status |
| **Hand it to a person** | someone presses "Needs a person" | | tell the team, hold the order, set a status |

The last two start with a custom trigger. They show **Comes with buttons and scanning** and cannot be used until you
have at least one custom trigger; see [Custom triggers](/automations/custom-triggers).

Some goals are shown but cannot be used yet, because the module they need is not available: **Thank the buyer** and
**Ask for a review** (**Comes with messaging**), and **Issue a receipt** (**Comes with invoicing**).

The **Coming from BaseLinker?** panel lists BaseLinker's names next to Omnilinker's. Type a BaseLinker name in the
search to find the matching goal.

## The editor

The editor is one sentence in blocks: **When**, **if**, **then**, and **If it fails**. Open an existing automation by
clicking its name on the **Automations** list, or **Edit** in its menu.

### When

Choose **What starts it**. The triggers are grouped by what they act on, and the editor shows each trigger's
description below it. Some triggers ask for more, such as the status and the number of days. See
[Triggers](#triggers).

For a trigger that counts days, the editor says: "Checked every hour. “3 days” means at least 3 days, so nothing is
missed because a check came late."

Changing the trigger removes what the new trigger cannot use: conditions on fields it does not have, and steps for
another kind of record.

### If

With no conditions, the automation acts every time: "Every time, with no conditions. Add one to narrow it down."

Click **Add a condition**, then choose the **Field**, **How it compares** and the value. The order must match all the
conditions. You can add up to 20.

How a field can be compared depends on what it holds:

| Field holds | How it compares |
| - | - |
| A choice, such as a status or a source | **is** or **is not** one or more values you pick, **is empty**, **is set** |
| An amount or a number | **is**, **is not**, **is at least**, **is at most**, **is between**, **is empty**, **is set**. An amount also has a **Currency**. |
| Yes or no | **is** yes or no |
| Text | **is**, **is not**, **contains**, **doesn't contain**, **is empty**, **is set** |
| A list, such as the SKUs of the order | **contains any of**, **contains all of**, **contains none of**, **is empty**, **is set** |

To remove a condition, click the cross next to it.

### Then

Choose a step under **Add a step**, then fill in what it asks for. Steps run in the order shown; move them with the
arrows, and remove one with the cross. You can add up to 20. See [Steps](#steps).

Turn on **Stop here if this fails** on a step when the steps after it make no sense without it. For example, a label
cannot be printed for a shipment that failed to be created.

"Saving applies from now on. Runs already under way finish the way they started."

### If it fails

Choose what happens once a run has failed for good, after its retries:

* **tell** the people to tell, **and everyone in** the role to tell;
* **and press** a custom trigger, for example one that hands the order to a person.

"Once per run that fails for good. Whoever made the automation is always told." The notifications arrive in the
Notification Center; see [Inbox](/notifications/inbox).

### Save

Click **Create** for a new automation, or **Save changes**. While you have changes that are not saved, the editor shows
**Unsaved changes**, and leaving asks "Leave without saving? Your changes will be lost."

Saving changes the automation from now on. A run that has already started finishes with the version it started with.

To delete an automation, click the bin next to **Save changes** and confirm: "Delete “…”? Its runs that haven't
finished are cancelled."

## Check before you switch it on

The panel on the right of the editor, **What it would do**, changes nothing.

### What it would have done last week

Once you choose a trigger, the panel looks at the last 7 days: "Over the last 7 days, it would have run" a number of
times, about so many a day. Below, a funnel shows how many times the trigger happened and how many orders were left
after each condition. When orders did not match, the panel names the condition most of them failed on and what they
had there.

For a trigger that counts days, the panel judges the orders as they are now, so the numbers are close rather than
exact. On a busy trigger it looks at the newest 2000 times the trigger happened, and says so.

### Try it on an order

Under **Try it on an order**, type an **Order number**, for example `#10482`, and click **Run test**. The panel says
whether the order matches, and if not, the condition it fails on. It then lists what each step would do, for example
"Would set the status to Packing."

"Nothing was done or sent. A test never reaches a carrier, a printer or a buyer."

### Worth knowing

The panel warns you about two things:

* Another automation sets the same thing, such as the status, at the same moment. It says which one runs first, and so
  whose value stays.
* This automation's steps start other automations. It shows the chain, marks the automations in trial, and says where
  the loop guard would stop it: "A chain stops after 5 automations in a row, so it can't loop."

You can also run an automation in **Trial** for a while before you switch it on. See
[Trial](/automations/overview#trial).

## The Automations list

**Automations** > **Automations** lists every automation as its sentence, in the order they run. Each row shows:

* the switch and the state. The switch turns an automation that is on off, resumes a paused one, and turns one that is
  off or in trial on;
* how many times it ran in the last 7 days, or for a trial, how many times it would have run;
* how many runs failed in the last hour and how many are waiting to retry;
* when it last ran, or **No runs in 7 days**.

When an automation has failed recently, a banner at the top says so, with **See its runs** and **Pause it**.

Find an automation with **Find by name or what it does**, or filter by **What starts it**, **Touches status** and
**State**. **Clear filters** shows them all again.

The menu of a row (**More actions**) has **Edit**, **Switch on** or **Resume**, **Run in trial** (for an automation
that is off), **Pause**, **Switch off**, the moves, and **Delete**.

### Order and groups

Automations with the same trigger run from top to bottom. To change the order, drag a row by its handle, or use
**Move up** and **Move down** in its menu.

Groups keep related automations together, for example "Payment":

* Add one at the bottom of the list: type its name and click **Add a group**.
* Drag an automation into a group, or choose **Move to** followed by the group's name in its menu. **Take out of the
  group** moves it back.
* The group's own menu has **Rename**, **Move up**, **Move down** and **Delete the group**. Deleting a group keeps its
  automations, outside any group.
* Switch a whole group off with its switch. Turning it back on restores each automation as it was.

Groups run in their order, and the automations under **Not in a group** run after the groups.

## What you can choose

### Triggers

| Trigger | When it happens |
| - | - |
| **An order arrives** | From a sales channel or through the API. Orders typed in by hand don't count. |
| **Delivery details arrive** | The sales channel sent the buyer's delivery form. |
| **An order is paid in full** | A payment covers the amount due. Part payments don't count. |
| **The status changes** | Someone, a sales channel or an automation sets a new status. |
| **An order is cancelled** | The order moves to a cancelled status. |
| **An order has been in a status for some days** | Counted from when it entered the status, once each time it enters it. |
| **An order has existed for some days** | Counted from when the order was created. |
| **A shipment was created** | A shipment for the order was created with a carrier, or entered by hand. |
| **A shipment's status changed** | The carrier's tracking moved a shipment of the order to another status, or a person did for a shipment entered by hand. Carriers are asked every 20 minutes; only carriers with tracking report it. |
| **A shipment was delivered** | A shipment of the order reached the buyer. A parcel delivered back to the sender doesn't count. |
| **Some days since a shipment was delivered** | Counted from when a shipment of the order reached the buyer. |
| Your custom triggers | A person presses its button or shortcut, or scans its barcode. See [Custom triggers](/automations/custom-triggers). |

For the triggers that count days, a day is 24 hours, the days are 1 to 365, and the check runs every hour. They fire
only for orders that reach the number of days after the automation is switched on, so a new automation does not act on
every order that has been waiting for months.

### Fields for conditions

Every trigger offers the order's fields: **Status**, **Status type**, **Source**, **Source account**, **Payment
status**, **Amount due**, **Amount paid**, **Delivery country**, **Invoice requested**, **Priority**, **SKUs**,
**Products**, **Number of items**, **Delivery details complete** and **Has a shipment**.

Some triggers add fields of their own:

| Trigger | Its own fields |
| - | - |
| **The status changes** | **Previous status** |
| **An order is paid in full** | **Payment amount** |
| **A shipment was created** | **Carrier**, **Entered by hand** |
| **A shipment's status changed** | **Carrier**, **Shipment status**, **Previous shipment status** |
| **A shipment was delivered** | **Carrier** |

### Steps

| Step | What it does |
| - | - |
| **Set the status** | Move the order to a status. A cancelled status cancels the order and releases its stock. |
| **Set the priority** | Set the order's priority flag, from 0 to 5. |
| **Add to the admin comment** | Add a line to the order's admin comment; what is already there stays. |
| **Create a shipment** | Book the order's shipment with a **Courier service**, to the order's delivery address or the parcel locker the buyer chose. You give the **Weight (kg)**, and optionally **Length (cm)**, **Width (cm)**, **Height (cm)** and the **Parcel size, as the carrier names it (e.g. a locker size)**. An order that already has a shipment keeps it. |
| **Print the shipping label** | Print the label of the order's newest shipment where its labels print. A label the carrier hasn't sent yet prints when it arrives. See [Where labels print](#where-labels-print). |
| **Tell people** | Send a notification with your **Message** to chosen **People** or a **Role**. |
| **Hold automations** | Stop automations from starting on this order by themselves until someone releases it. Optionally with a **Reason**. |
| **Run a custom trigger** | Press one of your custom triggers on the order, as this automation. The automations it starts run as they would for a person's press, in the same chain. |

**Create a shipment** books a real shipment with the carrier, which may be charged; see
[Shipments, labels and tracking](/shipping/shipments). It never books twice for the same run, even when it is tried
again.

#### Where labels print

**Print the shipping label** sends the label the way a person's print would; see
[Automatic printing and routing](/devices/automatic-printing). When the run was started by a press at a station, for
example in floor mode, it prints at that station when that station can take the label. Otherwise it goes the usual way.

A label that waits at a station, for example because its printer has stopped, does not make the step fail: the step
says where the label went. To print waiting labels somewhere else, open **Devices** > **Stations** and use **Send …
waiting to …** on the station, or move the jobs on **Devices** > **Print jobs**; see
[Print a job somewhere else](/devices/print-jobs#print-a-job-somewhere-else).

A shipment an automation creates when nobody pressed it at a station has no station of its own, so its label prints
at the station it is routed to as any label is, and otherwise waits on **Devices** > **Print jobs** as **Unassigned**
until someone chooses a printer.

## Next steps

<CardGroup cols={2}>
  <Card title="Custom triggers" icon="mouse-pointer-click" href="/automations/custom-triggers">
    Start automations with a button, a shortcut or a barcode.
  </Card>

  <Card title="Runs and activity" icon="activity" href="/automations/runs-and-activity">
    Follow what your automations do.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.