Trigger a Microflow From a Menu Item
1 Introduction
Mendix uses visual models called microflows to define the logic of your application. Microflows are visual ways of expressing what traditionally would be written in code. This how-to explains how you can create a very simple “Hello World” microflow.
This how-to teaches you how to do the following:
- Create a menu item
- Create and edit a microflow
2 Prerequisites
Before starting this how-to, make sure you have completed the following prerequisites:
- Familiarize yourself with microflow terms. For more information, see Microflows.
2 Creating a Menu Item
You will create a menu item that will trigger a microflow and show the Hello World message to the end-users.
Microflows can be triggered in many different ways. For this how-to, you will use a menu item to trigger the new microflow.
To create a menu item, follow these steps:
-
Open the Navigation editor.
-
In the Responsive tab > the Menu section, click New Item:
-
In the New Menu Item dialog box, set the Caption to Hello World:
-
For On click, select Call a microflow:
-
In the Select Microflow dialog box, select a microflow and then click New:
-
Enter HelloWorld for the Name of the new microflow.
-
Save the new menu item by clicking OK.
You have created the menu item that will trigger the Hello World microflow.
3 Editing the New Microflow
The new microflow is now empty and needs to be configured to show the message to the end-users.
To edit the new microflow, follow these steps:
-
Open the Hello World microflow by right-clicking the new menu item created in the Creating a Menu Item section above and selecting Go to target from the context menu:
You will see an empty microflow like this:
-
Open the Toolbox and search for the Show message activity:
-
Drag the Show message activity from the Toolbox into the flow between the start event and end event, which will insert a show message activity:
-
Double-click the message activity to open the Show Message properties.
-
Enter Hello World for the Template value and click OK:
-
Click Run Locally and then View to see the application in your default browser.
-
Click the Hello World menu item in the menu bar to see the message:
Congratulations! You have created the menu item that triggers the microflow and shows the Hello World message to your end-users!