Mendix Advanced Developer study materials
Mendix Advanced Developer study resources

Mendix Advanced Developer: Microflow and Nanoflow Logic

Mendix Advanced Developer · Work through your exam, one topic at a time.

All guide sections

Microflow and Nanoflow Logic

Control flow

Microflow variables are typed and scoped to the flow; a loop body sees the iterator plus any variable created before the loop. Use Create variable for constants and counters and Change variable for accumulation. Break and Continue only apply inside a loop. Every split must merge before the end event unless each branch ends itself, and the modeler enforces this.

Errors as control flow

Any activity can carry an error event: Continue ignores the failure, Custom without rollback keeps the changes made so far, and Custom with rollback discards uncommitted changes and ends that branch. An unhandled error bubbles to the caller and finally to the client, so the outermost microflow should own the handler and produce the user-facing message.

Nanoflows

Nanoflows execute on the client. They cannot call Java actions and cannot run runtime-only activities, and they work against the client data layer - the local store in offline apps, previously retrieved data in online apps. Authoritative validation and anything touching integrations belong in a microflow that the nanoflow calls.

Worked example

ACT_SubmitOrder loops over order lines and calls SUB_ReserveStock(line), which may raise the custom error Out of stock. The call's error event is Custom with rollback, so a failed reservation never leaves partial stock reservations; the loop breaks and a message returns to the page. Reasoning: doing this in a nanoflow would put the stock decision on the client, where it cannot be trusted.

Traps

Committing inside a loop instead of committing the list once; using Continue where a rollback is required; reading $currentObject after a rollback has removed it; expecting nanoflow access rules to protect the underlying data.