MitDesk docs
Automations

Automations you can read

9 min read Odoo 20.0

An automation, also called a flow, is a diagram. It starts with a trigger, follows your rules and does a few steps. The diagram is the real program: there is no hidden code behind it. This page explains how to build one, what it can do and what it checks before it goes live.

Who this is for: people who build flows.

You need: Edition: Pro and above (module minddesk_flow). See Editions.

The Automations list: 12 flows with record type, trigger, state, version and the user each one runs as

Who can build one

  • Automation Manager can create, edit and publish flows. Every MitDesk Administrator is also an Automation Manager.
  • Other MitDesk users can only read flows and their runs.
  • A flow that carries autonomy rules can only be published by a MitDesk Administrator. See Dry runs and grants.

Start a flow

Open Automations. You have three ways to begin:

  1. New opens a short setup dialog. Choose Scheduled or Event, give the flow a name, pick the record type (the model), the user it runs as, and press Create draft.
  2. Create with AI asks you to describe the job in a sentence and picks who the flow runs as. MitDesk drafts the flow for you. Nothing runs until you publish it.
  3. Open an empty draft and pick one of the 12 templates. The list only shows templates for the record type of your draft. A template is not offered if its record type or a field it uses is missing in your database.

The New Event Flow dialog: mode, name, record type, trigger type, watched field and run-as user

A new flow is always a Draft. A draft never runs.

The builder

The visual builder shows the steps as boxes joined by arrows. Drag a step from the left panel, or press Add step and search for it.

The builder: steps Every week, Company account and Log AR review note, the step palette, and the toolbar with Details, Run history, Dry run, Save as template, Save and Publish

The toolbar has these buttons:

Button What it does
Details Opens the flow as a form with settings, budgets, runs and autonomy rules.
Run history Shows every run of this flow.
Dry run Tests the flow on one record and writes nothing. See Dry runs and grants.
Save as template Keeps this draft as a template for later. Only an Automation Manager or Administrator can do this.
Save Saves the draft.
Publish Checks the flow and switches it on.

Click a step to set it up. Each step has a Setup tab, a Data tab (the fields you can use in texts) and an Errors tab. Click empty space to see the Flow settings: the record type, Runs as and If a step fails.

You cannot change a live flow. Press Edit as draft to make a copy. The copy keeps the steps, the arrows and the autonomy rules. Publish the draft when you are done. The new version replaces the old one.

Steps you can use

Group Step What it does
Trigger On update, On creation, On a date Starts the flow. A flow has exactly one trigger.
Logic Condition Goes on only if the record matches a filter.
Logic Branch Has a yes path and a no path.
Logic Switch Chooses a path by the current value of one field.
Logic Loop Repeats the steps inside it for each linked record.
Actions Set field Writes a value into a field.
Actions Create activity Plans an activity on the record.
Actions Send e-mail Sends an e-mail from a template.
Actions Add followers Adds followers to the record.
Actions Run a tool Runs one MitDesk tool that you choose. The AI does not choose it.
Actions Server action Runs an Odoo server action that is allowed for MitDesk.
AI Ask an AI agent Gives a task to an agent and keeps its answer.
AI Ask an AI a yes/no question Asks one question about the record. The answer picks the yes or the no path.
AI Assign to a digital employee Hands work to a digital employee.
Flow Approval Waits for a person to say yes. The request ends after 1440 minutes (24 hours) unless you set another time.
Flow Delay Waits before it continues.

Some details:

  • An AI yes/no answer must be a clear yes or no. If MitDesk cannot read the answer, it counts as an error. It never silently takes the no path by chance.
  • A Loop repeats only action steps and tool steps. It takes 20 linked records by default and never more than 100.
  • A step inside a loop that needs approval does not stop the run. MitDesk asks for the approval and moves on to the next record. The approved action runs later, on that record.
  • You can set If this step fails on each step. This overrides the flow setting for that step.

When a flow starts

Trigger When it starts
On creation A record is created.
On update A record changes. You can watch only some fields.
On creation or update Both of the above.
On deletion A record is deleted. Only a few steps are allowed, because the record is gone.
On a schedule Every N minutes, hours, days, weeks or months, or on a weekday, on a day of the month, or with a five-field cron expression.
On a date A date field of the record arrives. You can start some days before or after, at a time you choose. Each record runs at most once a day.

The setup dialog and the flow form offer all six triggers. The builder palette shows three of them, and you set the others in the trigger step.

Times are read in the time zone you set on the flow. The exception is a cron expression, which always uses UTC. A cron expression only works if the Odoo server has the optional croniter package.

A scheduled flow either runs once for each record that matches its filter, or runs once for the whole job with no record. It takes at most 500 records per run unless you change Max batch records.

Who a flow acts as

Every flow runs as one named user. It can only do what that user can do by hand. It never runs as the superuser.

  • You cannot choose OdooBot, a portal user, an Odoo administrator or an archived user. The user must be a MitDesk user.
  • A MitDesk Administrator can choose any allowed user. An Automation Manager can only choose themselves.
  • An AI step must use an agent that runs as the same user as the flow. If not, publish stops.

Every step that changes data passes through the same consent gate as the chat. The step runs, or it asks a person, or it is refused. If it asks, the run waits. When the decision is made, a job continues the run. The job checks every two minutes.

If a step is refused, the If a step fails setting decides what happens:

  • Stop the run and tell me ends the run.
  • Skip the step and carry on goes to the next step.

Publish

Press Publish. MitDesk checks the flow first. Then it switches the trigger on: an Odoo automation rule for event triggers, or a scheduled job for schedules and dates. Publishing a draft of a live flow raises the version number and switches the old version off. Only one version is live at a time.

Publish stops if:

  • there is no trigger, or more than one;
  • the steps form a circle;
  • a step has no arrow leading to it;
  • a loop has no steps inside;
  • a text uses the answer of a step that does not give one, or that has not run yet;
  • a filter uses a field that the record type does not have;
  • a switch has no stored field, no cases, or an arrow with a label that is not a case;
  • a tool or a server action does not exist, is not allowed for MitDesk, or belongs to another record type;
  • an AI step uses an inactive agent, or an agent without a run-as user, or an agent that runs as someone else;
  • the trigger is a date or schedule with wrong settings;
  • on a deletion trigger, there is a Delay, or an action other than Create activity, Send e-mail and Add followers;
  • the flow runs once for the whole job, but a step needs a record;
  • an autonomy rule would not take effect.

Milder problems are only warnings. Examples are a decision with nowhere to go, a branch with only one arm, or a switch case with no arrow. The builder marks them on the step, and you can still publish.

The flow form has an optional Agent field. If you fill it in, the form warns you when another live flow fires the same agent on the same trigger.

What a run looks like

Every time a flow starts for a record, it creates a run. Open Configuration ▸ What has run ▸ Flow Runs, or the Runs tab of the flow.

The flow runs list: flow, affected record, state Done or Waiting for approval

You can filter by Failed, Waiting on somebody, Waiting on a timer and Done. A run is in one of these states: Running, Waiting for approval, Waiting for agent, Waiting for a digital employee, Waiting for a called flow, Waiting (delay), Done and Failed.

Open a run to see the Path timeline: each step, its status, a short summary and the approval it waited for. Replay path on canvas shows the same path on the diagram.

One flow run with its path timeline and the Replay path on canvas button

A failed run is final. MitDesk does not try again, because a second try could change data twice. Instead it creates a to-do for the flow owner. A run that waits more than 24 hours for a person or an agent also creates a to-do. The owner is the person who created the flow.

Limits and the pause switch

Each flow has its own limits on the Details form. See Dry runs and grants.

Configuration ▸ Pause / Resume Autopilot is one switch for all flows. Only MitDesk Administrators can use it. The form shows how many flows are active.

When you press Pause all Autopilot:

  • No event flow and no scheduled flow starts.
  • Scheduled jobs still tick, but they do nothing.
  • Runs that wait for a delay stay waiting.
  • Runs that wait for an approval, an agent, a digital employee or a called flow also stay waiting, even after someone approves. They continue only after you resume.
  • A step that was already running is stopped with the error "Autopilot is paused".

Dry run still works. Resume all Autopilot needs no new publish. The pause is a stop, not an undo: what already ran stays done.

If it does not work

If Publish stops, the builder marks the step that needs a change. For other messages, see Troubleshooting.