You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/csharp/extensibility-api-howtos/create-microflow-service.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,19 +7,18 @@ weight: 14
7
7
8
8
## Introduction
9
9
10
-
The `IMicroflowService` is the service used to perform actions related to microflows. This how-to describes how you can create a new microflow and add some activities to it.
10
+
This how-to describes how to create a new microflow and add activities to it. The `IMicroflowService` is used to perform actions related to microflows.
11
11
12
-
## `Initialize`
12
+
## Creating and Initializing a Microflow Using `Initialize`
13
13
14
-
The `Initialize` method initializes a microflow that was previously created. It is part of a series of steps required for adding a microflow to the model:
14
+
The `Initialize` method initializes a microflow that was previously created. Follow the steps below:
15
15
16
-
1. Start a transaction (`IModel.StartTransaction`).
17
-
2. Create a microflow and add it to the module (`IModel.Create<IMicroflow>`).
18
-
3. Call `IMicroflowService.Initialize`.
16
+
1. Start a transaction using `IModel.StartTransaction`.
17
+
2. Create a microflow and add it to the module. Use `IModel.Create<IMicroflow>` to create the microflow and add it to the desired module.
18
+
3. Initialize the microflow by calling `IMicroflowService.Initialize`. The `Initialize` method sets up the start and end flows, and adds any parameters (for example, `boolParameter` of `DataType.Boolean`).
19
+
4. Insert activities into the microflow using `IMicroflowService.TryInsertAfterStart` to add the first activity, and `IMicroflowService.TryInsertBeforeActivity` to insert subsequent activities.
19
20
20
-
Internally, the `Initialize` method sets up the start and end flows, and adds any parameters that might be passed in (in the example below, you are passing a single parameter `boolParameter` of `DataType.Boolean`).
21
-
22
-
In the example below, you also add activities to the microflow, with `IMicroflowService.TryInsertAfterStart` (adding an activity as the first) or `IMicroflowService.TryInsertBeforeActivity` (adding an activity before another).
As you can see, this `IMicroflowService.Initialize` method can be cumbersome to use, since it is only part of the whole process of creating a new microflow. To have an easier method of creating microflows, use the `MicroflowService.CreateMicroflow` method. This method is described in the next section.
49
+
Note that this `IMicroflowService.Initialize` method requires multiple manual steps. For a simpler approach, use the `MicroflowService.CreateMicroflow`, described in the section below.
50
+
51
+
## Creating a Microflow Using `CreateMicroflow`
51
52
52
-
##`CreateMicroflow`
53
+
The`CreateMicroflow` method is the more advanced and comprehensive method to create microflows. It is an alternative to the `IMicroflowService.Initialize` method. The `CreateMicroflow` method handles initialization and model integration in one step. It requires:
53
54
54
-
The `CreateMicroflow` method is the more advanced and comprehensive method to create microflows. It is a good alternative to the `IMicroflowService.Initialize` method.
55
-
The `CreateMicroflow` takes care of initialization and adding everything to the model in one single step. It requires the current `IModel`, the `IFolderBase` (module or folder) in which to save the microflow, a name, an optional `MicroflowReturnValue`, and an optional list of parameters. See the code below for a few examples.
55
+
* The current `IModel`
56
+
*`IFolderBase` (module or folder)
57
+
* A name,
58
+
* Optional:
59
+
*`MicroflowReturnValue`
60
+
* List of parameters
56
61
57
62
### Creating a Simple Microflow
58
63
59
-
As shown in the code below, all that is required to create a microflow and add it to the model is the`IModel`, the `IFolderBase` in which to add the microflow, and its name.
64
+
As seen in the code below, the only requirements are`IModel`, the `IFolderBase`, and its name.
60
65
61
66
```csharp
62
67
publicvoidCreateMicroflow(IModelcurrentApp)
@@ -73,7 +78,7 @@ public void CreateMicroflow(IModel currentApp)
73
78
74
79
### Creating Microflow with Return Type and Parameters
75
80
76
-
In this more advanced example, you will see the `IMicroflowExpressionService.CreateFromString` method, which allows you to create expressions that can be then used as the `MicroflowReturnValue` of the microflow. Here, the expression is a simple addition of two values, and the return type is of `DataType.Integer`.
81
+
In this more advanced example, you see the `IMicroflowExpressionService.CreateFromString` method, which allows you to create expressions that can be then used as the `MicroflowReturnValue` of the microflow. Here, the expression is a simple addition of two values, and the return type is of `DataType.Integer`.
0 commit comments