Microflows in the Mendix Metamodel

Last modified: August 20, 2024

Introduction

Microflows have parameters, a return type (the return value is defined in an object, see below), and allowed module roles. Rules are similar to microflows, but have rule parameters, and they do not have some Microflow-specific properties

Graphical Overview

Studio Pro Guide Model SDK API docs
The Microflows overview page The microflows package
Microflow, technical information on properties of a microflow Microflow
Rule Rule
Parameter MicroflowParameter

Microflow and Rule Structure

Microflows consist of a collection of objects connected by flows. The objects represent activities, such as Object manipulation and retrieval, microflow calls, web service calls, etc. (details follow below).

For example, a simple microflow could consist of a start event, a single activity, and an end event. The microflow would then have three MicroflowObjects in its MicroflowObjectCollection, and would have two SequenceFlows. The first sequence flow would have the start event as its origin and the activity as its destination. The second sequence flow would have the activity as its origin, and the end event as its destination.

Graphical Overview

Studio Pro Guide Model SDK API docs
Activities MicroflowObjectCollection
Sequence Flow SequenceFlow

Microflow Objects

There are several types of objects that can be added to a microflow. One type is Activity, which can either be a loop, or an action activity, which will execute a microflow action (see the next section for more details on different types of activities). Other microflow object types include start and end events, decisions and merges, annotations and parameters.

Graphical Overview

Studio Pro Guide Model SDK API docs
Activities MicroflowParameterObject, Activity
Start and End events StartEvent, EndEvent
Loops, with Break and Continue events LoopedActivity, BreakEvent, ContinueEvent
Annotation Annotation

Flows

A microflow consists of objects that are connected by flows, specifically, SequenceFlows. A flow has an origin and a destination, with which the order of objects in the microflow is defined.

A decision on an enumeration has a sequence flow for each enumeration value. In the meta model, this is represented by the case value of the sequence flows. Each sequence flow has an enumeration case value with value set to the corresponding enumeration case. Boolean decisions have two sequence flows, one for each of true and false, with each a corresponding case value.

Object type decisions have sequence flows for each specialization of the entity type on which is split. Each sequence flow has an inheritance case value with a specialization entity value.

Annotation flows are used to connect annotations to other microflow objects.

Graphical Overview

Studio Pro Guide Model SDK API docs
Sequence Flow Flow
Annotation flow SequenceFlow
AnnotationFlow
Properties origin and destination of Flow
CaseValue and its inheritance hierarchy

Decisions

The control flow in microflows is defined with decisions of two types:

  • Decisions – for Boolean or enumeration decisions
  • Object type decisions – for control based on specialization entity types

Two paths of a control can be merged with a decision.

A decision conditionally splits on either an expression or a rule. In case of a rule, a call is made, similar to a microflow call, with a rule parameter mapping.

Graphical Overview

Studio Pro Guide Model SDK API docs
Decision ExclusiveSplit
Object Type Decision InheritanceSplit
Merge ExclusiveMerge
Rules ExpressionSplitCondition
RuleSplitCondition
RuleCall
RuleCallParameterMapping

Microflow Activities

Working with Objects

Objects can be manipulated in microflows through several activities. New objects can be created. Existing objects can be retrieved (see the next subsection for details). All objects can be updated or deleted. All changes (including creation and deletion) can be committed or rolled back.

Object attributes can be updated with a change action, both in a create action and in an update action.These actions have a list of items that describe which attribute or association is set, to a certain value.

Graphical Overview

Studio Pro Guide Model SDK API docs
Create Object CreateObjectAction and ChangeObjectAction (ChangeMembersAction, MemberChange)
Change Object DeleteAction
Rollback Object CommitAction and RollbackAction

Retrieving Objects

A retrieve action is either an association-based retrieve or a database-based retrieve. An association-based retrieve points to a specific association and retrieves the relevant objects over that association. A database-based retrieve directly accesses the database and provides control over the XPath constraint, sorting of the retrieved objects and the range of objects to retrieve.

Graphical Overview

Studio Pro Guide Model SDK API docs
Retrieve RetrieveSource
XPath constraints AssociationRetrieveSource
DatabaseRetrieveSource
Range, ConstantRange and CustomRange
SortItemList and SortItem

Microflow Calls

Microflows can call other microflows by defining a mapping of expressions to parameters (of the called microflow).

Graphical Overview

Studio Pro Guide Model SDK API docs
Microflow Call MicroflowCallAction
MicroflowCall
MicroflowCallParameterMapping

Web Client Activities

Microflows can trigger behavior in the browser: showing and closing pages, showing (popup) messages, providing validation feedback and triggering file downloads.

Graphical Overview

Studio Pro Guide Model SDK API docs
Show Page and Show Home Page ShowPageAction and ShowHomePageAction
Close Page CloseFormAction
Show Message ShowMessageAction
Validation Feedback ValidationFeedbackAction
Download File DownloadFileAction

App Service Calls

An app service call action points to a specific app service action (which is part of a consumed app service). The action call has a list of parameter mappings of app service action parameters to expressions.

Graphical Overview

Studio Pro Guide Model SDK API docs
AppServiceCallAction
AppServiceAction
AppServiceCallParameterMapping
AppServiceActionParameter

Web Service Calls

A web service call to an imported web service has an HTTP configuration, and a request and response handling configuration to map the request and response parameters of the third-party web service operation to Mendix app concepts.

Graphical Overview

See the following diagrams for details on the HTTP configuration, request handling, and response handling.

Studio Pro Guide Model SDK API docs
Call Web Service WebServiceCallAction
HttpConfiguration
RequestHandling and ResultHandling

Web Service Calls – Request HTTP Configuration

An HTTP configuration has an optional custom endpoint location, authentication credentials, and optional HTTP headers.

Graphical Overview

Studio Pro Guide Model SDK API docs
Call Web Service HttpConfiguration
HttpHeaderEntry

Web Service Calls – Request Handling

A web service operation request needs to be mapped from Mendix app concepts to the specifics of the web service operation. There are four different ways in which request handling can be configured. Each has its own specific configuration options.

  1. Export Mapping – The recommended option whenever you are sending complex XML objects (non-primitives) to a third party.
  2. Simple Parameter Mapping – Use this option when you are just sending primitive values to a third party. The argument can be any MicroflowExpression producing a value compatible with the parameter type. The ElementPath is a string representing the place in the element tree of the parameter in the XML message.
  3. Advanced Parameter Mapping – This is a combination of the above two mappings, starting one level deeper in the XML hierarchy than a regular export mapping. Use a MicroflowExpression for a primitive value and an ExportMapping for a complex one.
  4. Custom mapping – Specify the XML to be sent manually. Powerful yet dangerous.

Graphical Overview

Studio Pro Guide Model SDK API docs
Call Web Service RequestHandling
SimpleRequestHandling - WebServiceOperationSimpleParameterMapping
AdvancedRequestHandling - WebServiceOperationAdvancedParameterMapping
MappingRequestHandling
CustomRequestHandling

Web Service Calls – Response Handling

The result of a web service operation needs to be mapped to Mendix app concepts with an import mapping call which uses an import mapping. The range of objects to map can also be controlled.

Graphical Overview

Studio Pro Guide Model SDK API docs
Call Web Service ResultHandling
ImportMappingCall
ImportMapping
Range

Variables

Microflow variables can be created and changed with specific actions. A create variable action also has a data type to indicate the type of the newly created variable.

Graphical Overview

Studio Pro Guide Model SDK API docs
Create Variable CreateVariableAction
Change Variable ChangeVariableAction

Lists

Lists can be created, changed and deleted with specific actions. List aggregation actions have a specific function (for example, sum or average). List operations can also be run, see the following sections for details.

Graphical Overview

Studio Pro Guide Model SDK API docs
Create List CreateListAction
Change List ChangeListAction
Aggregate List DeleteAction
List Operation AggregateListAction
ListOperationAction and ListOperation

Lists – Operations

Lists can be manipulated with different types of operations. Lists can be sorted, with a list of sorting items. Head and tail provide the first and remainder of a list, respectively. Find and filter respectively pick one and all elements of a list that adhere to some condition.

Graphical Overview

Studio Pro Guide Model SDK API docs
List Operation ListOperation
Head and Tail
Sort, SortItemList and SortItem
Filter and Find

Lists – Binary Operations

Lists can be manipulated with several binary operations, which take two lists as input.

Graphical Overview

Studio Pro Guide Model SDK API docs
List Operation BinaryListOperation
Contains
Intersect
ListEquals
Subtract
Union

Java Action Calls

Java action calls point to a specific Java action and have a parameter mapping with an expression for every parameter of the Java action.

Graphical Overview

Studio Pro Guide Model SDK API docs
Java Action Call JavaAction
JavaActionParameter
JavaActionCallAction
JavaActionParameterMapping

Logging

Logging actions target a single log node on a specific log level. The log message is parameterized.

Graphical Overview

Studio Pro Guide Model SDK API docs
Log Message LogMessageAction
LogLevel
StringTemplate
TemplateArgument

Importing and Exporting XML

XML import actions use an XML-to-domain mapping similar to web service response mappings.

XML export actions use a domain-to-XML mapping similar to web service request mappings.

Graphical Overview

Model SDK API docs

Document Generation

Documents are generated from a document template. Such a template has parameters, which are mapped with a parameter mapping at each call site.

Graphical Overview

Studio Pro Guide Model SDK API docs
Generate Document GenerateDocumentAction
DocumentTemplate
DocumentTemplateParameterMapping