Manual
Use the Manual trigger for a flow that only runs on demand. It listens to no Business Central event and no schedule – the flow runs when someone starts it.
A manual flow can run on its own or on a record of a table you choose, for example on a sales order or a customer.
Typical examples include:
- Giving a user a one-click way to launch a routine (re-sync, send a digest, rebuild data) without scheduling it.
- Processing records a user picks: "send the reminder mail for these customers", "recalculate these orders".
- Testing a flow during development without firing the underlying event.
Configure the trigger
Runs on table – optional. Leave it empty for a flow that does not run on a record. Pick a table to make the flow run on one record of that table: the record is then available to every step as the SmartField Rec.
Open execution card – what happens when a run you started and waited for has finished: Never shows nothing when it succeeded and offers to open a run that failed, On error opens a failed run right away, Always opens the run whether it succeeded or not. Several runs open as the executions list. Runs nobody waits for – started by another flow, from an extension without the dialog, or in the background – never open anything.
Like every flow, a manual flow needs a Code on the flow card before it can be published (see Flow Code and versions). Other flows and extensions start a manual flow by its Code.
Start the flow
Click Run this flow on the Flow card or in the Flow Workspace.
- A flow that does not run on a record starts once.
- A flow that runs on a record first opens a filter page for its table. Set filters to choose the records, confirm the question how many records the flow will start for, and AutoFlow starts one execution per record.
A dialog then shows how far the executions are and the latest message from their execution log. It closes when all executions have finished. If one of them ended with an error, AutoFlow offers to open it.
The flow runs in the background (Job Queue), not in your session, so steps that show a dialog to the user are not available in manual flows. If a run takes longer than five minutes, the dialog closes and the flow keeps running – you can follow it in the executions list.
If AutoFlow Setup is set to start flows manually, the runs are only queued and the dialog tells you so.
Start the flow from a page
Start from pages – optional. List the Business Central pages whose Start Flow action should offer this flow. Supported are the card and the list of:
- sales quotes, orders, invoices, credit memos, return orders and blanket orders,
- posted sales invoices, credit memos and shipments,
- purchase quotes, orders, invoices, credit memos, return orders and blanket orders,
- posted purchase invoices, credit memos and receipts,
- reminders and issued reminders,
- customers, vendors, items and contacts.
A flow that runs on a record can only be assigned to pages that show records of its table – a flow on the Sales Header table fits the sales order card and list, but not the customer card. The status line tells you when a page does not fit. A flow that does not run on a record fits every supported page.
After you publish the flow, the page shows the action Start Flow. It only appears when at least one active flow is assigned to the page. Choosing it lists the assigned flows; pick one to start it:
- On a card, a flow that runs on a record starts for the record you are looking at.
- On a list, it starts once per selected record. If you selected more than one, AutoFlow asks first how many executions it will start.
- A flow that does not run on a record starts once.
The same dialog as above follows the runs, and the page refreshes when they are done.
Start the flow from another flow
Use the Start flow step: every active manual flow appears in the step selector of your other flows.
Start the flow from an extension
Developers can start a manual flow from their own code by its Code, optionally on a record, with the public codeunit mse365 AF Manual Flow API. They can wait with the same dialog, wait silently and read the result, or start the flow without waiting.
An extension that must not depend on AutoFlow – because it is also sold without AutoFlow – starts the flow through codeunit 5564812 mse365 AF External Start instead. It passes a temporary Name/Value Buffer (a standard Business Central table) with one row per value and gets the result back in the same buffer. As with every manual start, the flow gets the record and nothing else; its steps read everything further from there.
| Name | Value |
|---|---|
FlowCode | The Code of the flow. |
TableNo, SystemId | The record the flow runs on: its table number and its SystemId. Only for a flow that runs on a record. |
Mode | FireAndForget (default) starts the flow and returns at once, Silent waits for the result, WaitDialog waits with the progress dialog, Inline runs the flow to its end in the caller's session – no Job Queue, no time limit – and always returns Success or Error. A flow with a Sleep step cannot run Inline. |
After the call the buffer holds ExecutionEntryNo, Status (Pending, Running, Success or Error) and, when the run failed, Message with its error (the whole text in Value Long). If the flow cannot be started – unknown Code, a record of the wrong table, a name not listed above – the call raises an error.
TempBuffer.AddNewEntry('FlowCode', 'NOTIFY_SALES');
TempBuffer.AddNewEntry('TableNo', Format(Database::"Sales Invoice Header"));
TempBuffer.AddNewEntry('SystemId', Format(SalesInvoiceHeader.SystemId));
Codeunit.Run(5564812, TempBuffer);
With Action set to ListFlows, the buffer comes back with one row per active manual flow instead: the Code, the description and, in Value Long, the number of the table the flow runs on (0 for none). Check first that the codeunit exists (AutoFlow is installed) before you call it.
Best practices
- Use it for flows that should never auto-start. Anything where an unintended run would be expensive (mass email, bulk update) is a good fit – there is no event that could start it by accident.
- Check the record count before confirming. Empty filters select every record of the table.
- Don't use Manual for scheduled work. If the flow has to run periodically, use the Scheduled trigger instead.