Skip to content

Add an automation

An automation is the system reacting to a fact and acting on it, with nobody pressing a button. In Acme Commerce, EmptyBasketAfterCheckout empties the basket once checkout has completed. For the idea, read Automations and translations.

  1. In the header of a feature, select Add, then Add Slice.

  2. Choose Automation: System reacts to events and issues commands.

  3. Name the slice, for example EmptyBasketAfterCheckout.

The AutoApproveSmallOrders automation on the Sales board: the system reacts to an event and issues a command
An automation on the Sales board: AutoApproveSmallOrders runs on its own when an order arrives.

An automation has no screen and no person behind it. Its row belongs to the module’s System Actor, drawn with a cogwheel. A module has exactly one system actor, and every automation in the module shares that row. See Actors and personas.

An automation needs to know when to run. The small lightning bolt in a circle, in the lower corner of its row, is the trigger. In the picture, TakeStockWhenDispatched sits on the Warehouse board between DispatchShipment and TakeDispatchedStock: the cogwheel is the system actor, TakeDispatchedStock is the command it issues, and Add refusal handling is the link you use below.

The TakeStockWhenDispatched automation on the Warehouse board: a cogwheel with the command TakeDispatchedStock and the Add refusal handling link, the trigger bolt in a circle at the lower right, between the DispatchShipment and TakeDispatchedStock slices
Look for the cogwheel, the command name under it, the Add refusal handling link and the lightning bolt in a circle: that bolt is the trigger.
  1. Select Add trigger.

  2. Choose a kind:

    • Event: when a specific event happens, such as CheckoutCompleted.
    • Timer: on a fixed schedule, such as a nightly clean-up. Pick a schedule template or describe your own in plain words.
    • Custom: describe the behavior in your own words and let generation use the description.
  3. To change it later, use Change trigger type, Edit trigger or Remove trigger. For an event trigger, Edit trigger opens Event trigger: choose the event under Select trigger event, then select Save. Delete trigger takes the trigger away, and Cancel leaves it as it was.

The Event trigger dialog with ShipmentHandedToCarrier chosen under Select trigger event, and the Delete trigger, Cancel and Save buttons
The automation runs when the event in Select trigger event happens: here ShipmentHandedToCarrier.

Most of the time an event is enough: something happened, so something else should happen.

Say what happens when a command is refused

Section titled “Say what happens when a command is refused”

An automation usually issues a command, and a command can be refused. For each one you can say what the automation does about it.

  1. Select Add refusal handling under the command the automation issues.

  2. In Refusal branches, pick the kind of refusal: Any refusal, Validation, Constraint or Authorization.

  3. Choose Acknowledge the refusal, or add an event with Add event and give the values it carries. Add branch adds a branch for another kind of refusal.

  4. Select Save. With no branches, a refusal of the command is not answered.

The Refusal branches dialog after Add branch: one branch set to Any refusal with Acknowledge the refusal ticked, and the Move up, Move down, Remove branch, Add branch, Cancel and Save buttons
Each branch picks a kind of refusal (here Any refusal) and what to do about it. Use Move up and Move down to order the branches, and Remove branch to drop one.

The slice shows the cogwheel row of the system actor, its trigger and, below, the event it produces.