Skip to content

Commit 6cb38c0

Browse files
committed
Review microflow doc
1 parent 68fa5e9 commit 6cb38c0

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/csharp/extensibility-api-howtos/create-microflow-service.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@ weight: 14
77

88
## Introduction
99

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

12-
## `Initialize`
12+
## Creating and Initializing a Microflow Using `Initialize`
1313

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:
1515

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

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).
21+
### Example
2322

2423
```csharp
2524
public void Initialize(IModel currentApp, params IActionActivity[] actionActivities)
@@ -47,16 +46,22 @@ public void Initialize(IModel currentApp, params IActionActivity[] actionActivit
4746
}
4847
```
4948

50-
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`
5152

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:
5354

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
5661

5762
### Creating a Simple Microflow
5863

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

6166
```csharp
6267
public void CreateMicroflow(IModel currentApp)
@@ -73,7 +78,7 @@ public void CreateMicroflow(IModel currentApp)
7378

7479
### Creating Microflow with Return Type and Parameters
7580

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`.
7782

7883
```csharp
7984
void CreateMicroflow(IModel currentApp)

0 commit comments

Comments
 (0)