Microflows in the Mendix Metamodel

Last modified: February 7, 2024

1 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

1.1 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

1.2 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.

1.2.1 Graphical Overview

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

1.3 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.

1.3.1 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

1.4 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.

1.4.1 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

1.5 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.

1.5.1 Graphical Overview

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

2 Microflow Activities

2.1 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.

2.1.1 Graphical Overview

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

2.2 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.

2.2.1 Graphical Overview

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

2.3 Microflow Calls

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

2.3.1 Graphical Overview

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

2.4 Web Client Activities

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

2.4.1 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

2.5 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.

2.5.1 Graphical Overview

Studio Pro Guide Model SDK API docs
AppServiceCallAction
AppServiceAction
AppServiceCallParameterMapping
AppServiceActionParameter

2.6 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.

2.6.1 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

2.7 Web Service Calls – Request HTTP Configuration

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

2.7.1 Graphical Overview

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

2.8 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.

2.8.1 Graphical Overview

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

2.9 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.

2.9.1 Graphical Overview

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

2.10 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.

2.10.1 Graphical Overview

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

2.11 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.

2.11.1 Graphical Overview

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

2.12 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.

2.12.1 Graphical Overview

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

2.13 Lists – Binary Operations

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

2.13.1 Graphical Overview

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

2.14 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.

2.14.1 Graphical Overview

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

2.15 Logging

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

2.15.1 Graphical Overview

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

2.16 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.

2.16.1 Graphical Overview

Model SDK API docs

2.17 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.

2.17.1 Graphical Overview

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