# Flow Builder

The **Flow** construct in ProcessMIX is a diagram that describes the logic of a workflow process. It contains a collection of individual steps and controls the order in which they must be executed. Flow steps are depicted using nodes.&#x20;

The flow editor panel consists of several parts: Advanced Diagram Editor (ADE), flow settings, and node settings.

<figure><img src="https://3477030876-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYK40zKr4ZyVfqCRAUI9t%2Fuploads%2Ff7zj8OHUWFtQLiqWuXjE%2FFlow%20component_1.png?alt=media&#x26;token=0c7fe0f7-2008-4207-bade-d98c4a552be5" alt=""><figcaption></figcaption></figure>

Flow settings are used to set up flows, and edit their properties. There are common settings for a flow, including **initialize variables, channel, description,** and **local variables**. Other settings depend on the selected channel. For example, the **REST** channel includes the HTTP Method, Binding URL, Path, Request parameters, and both HTTP Request and Response. The **SOAP** channel features the SOAP Request and Response. The **Scheduled** channel provides settings based on how your project runs. The **Subflow** channel provides settings for input and output parameters. Further details on these settings can be found in the sections below.

Node settings are used to control a specific node in the flow: edit its basic parameters, such as name, as well as parameters specific to the node's type, such as assigning value to the input/output/local variable, choosing an asset to work with, and its parameters, functions to execute, and so on.

Node settings panel becomes available when clicking on the node.

**Advanced Diagram Editor (ADE)** is used to build a flow from the provided nodes.

For additional information, you can watch a video tutorial: [How to create a simple flow](https://www.youtube.com/watch?v=ATqq4dyks6U)

## How to Create a Flow <a href="#how-to-create-the-first-flow" id="how-to-create-the-first-flow"></a>

After the project has been created and you have started working on it, you will be redirected to the project's Integrated Development Environment (IDE), where you can develop its components.

When you start a project, you can create your first flow in several ways:

Option #1: create a flow by clicking on **New Flow** link in the center of the IDE.

<figure><img src="https://3477030876-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYK40zKr4ZyVfqCRAUI9t%2Fuploads%2F6Klbb8p2N2Y3F5zDd5hG%2FFlow%20component_2.png?alt=media&#x26;token=c45ad53e-bc27-4881-90f7-43cfeab6e551" alt=""><figcaption></figcaption></figure>

Option #2: open the Flows section in the left-side panel of the project explorer. Optionally, create or open a folder where you want to add your flow. Now create a flow by clicking on the **New Flow** <img src="https://processmix.com/wp-content/uploads/2023/02/image.webp" alt="" data-size="line"> button located at the top of the panel. In the pop-up window, enter the flow name and click on the **CREATE** button.

Option #3: go to Flows on the Project Explorer panel — left panel. Make sure you are in the Flows section. Click the right mouse button to open the context menu on the Explorer panel. Select the **New Flow** command. In the pop-up window, enter the flow name and click on the **CREATE** button.

{% hint style="info" %}
The Flow name should be longer than 1 symbol and shorter than 100, it can contain letters (Latin a-z A-Z), numbers 0-9, $, and an underscore. It should begin only with a letter or an underscore character.
{% endhint %}

<figure><img src="https://processmix.com/wp-content/uploads/2023/02/a2bd0d3c-ed16-42ad-9963-33f85e70f12b.png" alt="" height="141" width="500"><figcaption></figcaption></figure>

## How to Work With a Flow <a href="#how-to-work-with-flow" id="how-to-work-with-flow"></a>

Every flow is made up from a set of nodes. A flow node is the basic unit of work on the platform, through which information is processed and tasks are carried out.

The platform offers different types of nodes, each responsible for a particular type of information processing logic. By combining them, you can implement business solutions of any complexity.

## **How to Configure Flow Settings** <a href="#how-to-use-flow-settings-to-build-flow" id="how-to-use-flow-settings-to-build-flow"></a>

First, you need to configure the settings flow, which is available in the right panel of the builder.

<figure><img src="https://processmix.com/wp-content/uploads/2023/09/Flow-component_5-2-2-496x1024.png.webp" alt="" height="768" width="372"><figcaption></figcaption></figure>

Some settings are common for all channels, while others are specific to each type.

**Let’s look at the common settings:**

1. **Initialize variables**. This attribute declares the way the output and local variables will be initialized.\
   Let’s see an example:\
   The checkbox is unchecked: Output and local variables are all equal to NULL. Use the "initialize" or "initializeDeep" functions to initialize output or local variables.\
   The checkbox is checked: Output and local variables are initialized with default values.
2. **Channel.** Define the channel you need. A Flow can be used as a subflow, REST, scheduled, or SOAP.\
   When deciding on a channel, consider how you plan to use the flow:\
   – Use **Subflow** to create internal flow. Subflows can be used either independently or as a subflow within another flow, using the Subflow node.\
   – To generate and use a REST API in the flow, utilize **REST**.\
   – To generate a SOAP API and use it in the flow, utilize **SOAP.**\
   – Scheduled. This type of channel is used to perform flows on a schedule.
3. **Description**. Description (optional) will help you to understand the purpose and function of the process.
4. **Local variables**. Local variables are used for mapping source elements, mapping functions, or constants to a specific target element. They are declared and used only for the specific target element or attribute for which they are declared.\
   Rename the variable as needed.

{% hint style="info" %}
The Local variable’s name should be longer than 1 symbol and shorter than 255. It can contain letters (Latin a-z A-Z), numbers 0-9, $, and an underscore. Beginning from a letter. The name of the local variable must be unique within the flow.
{% endhint %}

You can quickly pick a simple variable's type by selecting from a list of readily available options:

* Boolean — value “true” or “false”
* String — text, for example, “Peter Peterson”
* Integer — whole number, for example, “22”
* Float — real number that can contain both integer and fractional part, for example, “0.1234”
* Date — specify the date value in the format yyyy-mm-dd, for example ‘’1993-05-31’’

To use less frequently used data types or your own custom data structures, click on the variable type field and select **See All**. You can then select the desired structure by navigating through the complete type selector tree.

Other flow settings will vary depending on the type of channel selected.

### How to Configure REST Flow Settings <a href="#how-to-set-up-rest-flow-settings" id="how-to-set-up-rest-flow-settings"></a>

**Channel settings**

Channel settings include the HTTP Method and Binding URL.

**HTTP Method**

Select the desired method from the list of available Methods.

Available HTTP Methods:

* POST:
  * The HTTP POST method sends data to the server.
  * It contains Path parameters, Request parameters, HTTP Request, and HTTP Response.
* GET (default):
  * The HTTP GET method requests a representation of the specified resource. Requests using GET should only be used to request data (they shouldn’t include data).
  * It contains Path parameters, Request parameters, HTTP Request (Empty request — always), and HTTP Response.
* DELETE:
  * The HTTP DELETE request method deletes the specified resource.
  * It contains Path parameters, Request parameters, HTTP Request, and HTTP Response.
* PATCH:
  * The HTTP PATCH request method applies partial modifications to a resource.
  * It contains Path parameters, Request parameters, HTTP Request, and HTTP Response.
* PUT:
  * The HTTP PUT request method creates a new resource or replaces a representation of the target resource with the request payload.
  * It contains Path parameters, Request parameters, HTTP Request, and HTTP Response.

**Binding URL**

A REST binding URL is a web address that identifies an endpoint. Flows are uniquely identified by their URLs. These URLs typically consist of a base URL followed by a path that identifies the specific endpoint.

If necessary, the URL can be supplemented with path and request parameters.

A path parameter is a placeholder in a URL path that is used to match a value in the request. Path parameters are typically used to identify a specific resource in the URL.

> For example:
>
> The URL can include:/users/123. The 123 parameter is a path parameter.

A request parameter is a value that is included in the request string of a URL. Request parameters are added to the end of the URL after a **?** character, and multiple request parameters are separated by **&** characters.

> For example:
>
> &#x20;The URL can include:/search?q=java\&page=1. The **q** and **page** parameters are request parameters.

Binding URL has a default state: /+{flow name}. For example: /flow. Available for editing.

Adjust the URL to correspond with the particular request.

> For example:
>
> 1. Path parameters should be in curly brackets “{}”. For example: /{companyId}
> 2. Request parameters should be added after “?“ also in curly brackets “{}”. For example: /api/v1/customers?search={search}

{% hint style="info" %}
* The maximum length of a URL should not exceed 2048 characters.
* Each URL should be distinct and not duplicated in the Project.
* The URL path parameters must match the parameters in the Path parameters block, and the request parameters in the URL must match the Request parameters.
{% endhint %}

If you enter parameters correctly in the URL, they will appear as **path** or **request** parameters in the corresponding fields when you move away from the Binding URL field.

To obtain a complete URL, please refer to the Swagger documentation section.

**Path parameters**

Path parameters are variable parts of a URL path. They are typically used to point to a specific resource within a collection, such as a user identified by ID. A URL can have several path parameters, each denoted with curly braces { }.

Each path parameter that is added in the URL binding as a path parameter is displayed in this field.

Add the Path parameters and select their type, if needed.

{% hint style="warning" %}
If you add a new parameter manually, you should also add it as a path parameter to the Binding URL field.
{% endhint %}

If there is a mistake, the error indicator will be displayed, the field borders will be highlighted in red. When the error is fixed, the red highlight disappears.

**Request parameters**

Request parameters are the most common type of parameters. They should be placed at the end of the request URL after a question mark (?), with different key-value pairs separated by ampersands (&). Request parameters are optional.

Each path parameter that is added in the URL binding as a request parameter is displayed in the Requests parameters section.

{% hint style="warning" %}
If you enter a new parameter manually, you should also add it as a request parameter to the Binding URL field.
{% endhint %}

If there is a mistake, the error indicator will be displayed, the field borders will be highlighted in red.

{% hint style="info" %}
Here are some tips for using path and request parameters:

1. Any required or mandatory attributes should be added as path parameters
2. Any optional attributes should be added as request parameters
3. Parameters used for filtering data are usually used as request parameters
{% endhint %}

**HTTP Request**

Indicate HTTP Request structure if needed.

Request bodies are typically used with “create” and “update” operations (POST, PUT, PATCH).

> For example:
>
> When creating a resource using POST or PUT, the request body usually contains the representation of the resource to be created.

{% hint style="info" %}
GET method has an empty request.
{% endhint %}

You can change the properties type by selecting from the list of possible options:

* String
* Boolean
* Integer
* Float
* Date

**To select another** **structure,** click the request body type field and select **See All**. You can select the desired structure by accessing the displayed structure selector.

**HTTP Response**

All API operations responses need to be specified. Each operation must have at least one response defined. A response is defined by its HTTP status code and the data returned in the response body and/or headers.

By default, the response body is specified as a String, but you can edit it if needed.

You can change the properties type by selecting from the list of possible options:

* String
* Boolean
* Integer
* Float
* Date

**To select another structure,** click the response body type field and select **See All**. You can select the desired structure by accessing the displayed structure selector.

**Additional operations with Path and Request parameters**

By clicking the right mouse button on the parameter, **a** **context menu** opens through which several operations are available.

1. **Add** — allows you to add parameters with a default value.
2. **Clone** — allows you to create a clone parameter. The cloned parameter will have the same name as the Name of the parent parameter + Clone(n) and the same type.
3. **Delete** — allows you to delete the parameter.

**How to Decide Which REST Channel Settings to Use**

> Here are some examples of how to adjust your REST channel settings:
>
> If you require information on “id”, you can easily retrieve it by specifying the parameter “id” as an integer in the Path parameter and enclosing it in brackets {id} within the URL before the “?” sign. When using the method, the value of “id” will be automatically inserted into the URL when executing the method. In this case, the following settings should be set:
>
> * HTTP Method: GET
> * Binding URL: /api/v1/customers/{id}/data
> * Path parameters: id
> * Request Parameters: –

> For example:
>
> The table provides additional examples of how to fill out the settings.

<table data-header-hidden data-full-width="false"><thead><tr><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Number</strong></td><td><strong>HTTP Method</strong></td><td><strong>Binding URL</strong></td><td><strong>Path Parameters</strong></td><td><strong>Request Parameters</strong></td></tr><tr><td>1</td><td>GET</td><td>/api/v1/customers/{id}/data</td><td>id</td><td>–</td></tr><tr><td>2</td><td>GET</td><td>/api/v1/customers?search={search}</td><td>–</td><td>search</td></tr><tr><td>3</td><td>PUT</td><td>/api/v1/customers/{userId}/{customerId}</td><td><p>userId</p><p>customerId</p></td><td>–</td></tr><tr><td>4</td><td>POST</td><td>/api/v1/company_resources</td><td>–</td><td> </td></tr></tbody></table>

#### **Swagger Documentation for Your Deployed Project’s REST API**

After finishing the project, you can deploy it, and then export Swagger documentation. The REST channel settings are included in the documentation.

In this way, you will get the full list of endpoints and all information about its components. Full REST API URL can also be seen in the Swagger document.

There are two ways to **get a complete REST URL:**

1. The Base URL is located at the top of the document. To get a complete REST API URL add the transfer protocol before the base URL and the path for your method after.

> For example:
>
> 1. Base URL: gateway.cloud.platform.com/deployment-phklyw95/
> 2. Path to the right of the HTTP method (Binding URL in the app): /api/v1/changeOrders
> 3. Complete REST URL: https://gateway.cloud.platform.com/deployment-phklyw95/api/v1/changeOrder

2. To “Call” the method click **TRY IT OUT**, then **EXECUTE.** You can see the method’s URL in the Request URL field.

{% hint style="info" %}
The flow can be started by “calling” the REST API by external users after the project has been successfully deployed.
{% endhint %}

### **How to Configure SOAP Flow Settings** <a href="#how-to-set-up-soap-flow-settings" id="how-to-set-up-soap-flow-settings"></a>

**SOAP Request**

The body contains mandatory information intended for the ultimate receiver of the message.

Indicate Request body structure if needed.

You can change the parameter type by selecting from the list of possible options:

* Boolean — value “true” or “false”
* String (default) — text, for example, “Peter Peterson”
* Integer — number, for example, “22”
* Float — floating-point or decimal number, for example, “0.1234”
* Data — specify the date value in the format format yyyy-mm-dd, for example ‘’1993-05-31’’

**To select another** **structure**, click the request body type field and select **See All**. You can select the desired structure by accessing the displayed structure selector.

{% hint style="info" %}
For SOAP flow input data in XML format, data located inside tags \<data> \</data>, should be wrapped in \<!\[CDATA\[…]]> tag.

* **CDATA Start section** − CDATA begins with the nine-character delimiter **\<!\[CDATA\[**
* **CDATA End section** − CDATA section ends with **]]>** delimiter.
* **CData section** − Characters between these two enclosures are interpreted as characters, and not as markup. This section may contain markup characters (<, >, and &), but they are ignored by the XML processor.
{% endhint %}



**SOAP Response**

By default the response body is specified as a String, but you can edit it if needed.

You can change the parameter type by selecting from the list of possible options:

* Boolean – value “true” or “false”
* String (default) – text, for example, “Peter Peterson”
* Integer – number, for example, “22”
* Float – floating-point or decimal number, for example, “0.1234”
* Data – specify the date value in the format format yyyy-mm-dd, for example ‘’1993-05-31’’

**To select another structure,** click the response body type field and **select See All**. You can select the desired structure by accessing the displayed structure selector.

#### WSDL for Your Deployed Project’s SOAP API <a href="#wsdl-for-your-deployed-projects-soap-api" id="wsdl-for-your-deployed-projects-soap-api"></a>

After finishing the project, you can deploy it. Then, export it in WSDL. The SOAP channel settings are included in WSDL.

You can see all the necessary information on created requests and use the WSDL file for further integration.

{% hint style="info" %}
The flow can be started by “calling” the SOAP API by external users after the project has been successfully deployed.
{% endhint %}

### How Configure Scheduled Flow Settings? <a href="#how-to-set-up-scheduled-flow-settings" id="how-to-set-up-scheduled-flow-settings"></a>

**Scheduled**

The flow frequency of execution is customized according to your need using the cron component. Such types of flow have no input or output.

A cron expression is a string of five to six blocks of values separated by whitespace, which represents a set of times or dates when a job or task should be executed, eliminating the need for an external “call”. Each value represents a specific unit of time, such as minutes, hours, days, and so on. The Crown Expression Generator helps to generate a crown expression from selected data.

To open the Cron Expression Generator, click the "Schedule" input field.

{% hint style="info" %}
The flow runs itself with the time-frequency specified with the "Schedule" field.
{% endhint %}

### How to Configure Subflow Settings <a href="#how-to-set-up-subflow-flow-settings" id="how-to-set-up-subflow-flow-settings"></a>

The subflow channel has input and output data. The flow runs when input data is received. This channel cannot be “called” from an external way such as REST or SOAP.

The subflow channel has the following additional settings:

1. **Inputs parameter.** Provide the necessary input parameters and their corresponding types required for the flow operation. This is the information the flow will take as input after the application is generated.\
   Rename the input parameter as needed.

{% hint style="info" %}
The input parameter’s name should be longer than 1 symbol and shorter than 255. It can contain letters (Latin a-z A-Z), numbers 0-9, $, and an underscore. Beginning from a letter character. The name of the input parameter must be unique within the flow.
{% endhint %}

You can change the variable type by selecting from the list of possible options:

* Boolean
* String
* Integer
* Float
* Date

To select another structure, click the variable type field and select **See All**. You can select the desired structure by accessing the displayed structure selector.

2. **Output parameter**. Define the output parameters: this is the type of parameters that will be returned once the Flow has finished executing.

You can change the output type by selecting from the list of possible options:

* Boolean
* String
* Integer
* Float
* Date

**To select another** **structure**, click the output type field and select **See All**. You can select the desired structure by accessing the displayed structure selector.

#### **Operations with input parameters and local variables** <a href="#operations-with-input-parameters-and-local-variables" id="operations-with-input-parameters-and-local-variables"></a>

Select input parameters or local variables on Flow settings. By clicking the right mouse button, a context menu opens through which operations are available.

**Let’s see what operations are possible here:**

1. **Add** — allows you to add a new parameter or local variables.
2. **Clone** — allows you to create a clone of the parameter or local variables. The cloned parameter will have a name as the Name of the parent parameter or local variables + Clone(n).
3. **Rename** — allows you to rename the parameter or local variables.
4. **Delete** — allows you to delete the parameter or local variables.
5. **Selection of a data type of the parameters or local variables** — allows you to change the type of the parameter or local variables.

## How to Build a Flow and Work With Nodes <a href="#how-to-build-a-flow-and-work-with-nodes" id="how-to-build-a-flow-and-work-with-nodes"></a>

After creation, each flow contains 2 nodes:

<figure><img src="https://processmix.com/wp-content/uploads/2023/09/Flow-component_empty-1.jpg.webp" alt="" width="375"><figcaption></figcaption></figure>

**IN** — start point of flow,

**OUT** — endpoint of flow

The node panel is a vertical panel, located on the left, from where you can add new nodes to the diagram.

<figure><img src="https://3477030876-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYK40zKr4ZyVfqCRAUI9t%2Fuploads%2FMMXHLJHbx2HYK8rPezKB%2FNew_Delete_Flow_Builder_7VAR_450px%20(1).jpg?alt=media&#x26;token=a6b118aa-98ac-42de-886d-cb8d9700f9c3" alt=""><figcaption></figcaption></figure>

You can read which nodes are provided in the application in the corresponding section.\
The order of nodes and their number in one flow are not limited, so you can create processes of any complexity. A separate flow can be connected by a subflow node.\
The order of operations execution in a flow is determined by the order of nodes.

As new nodes are added to the flow, each next node gets access to the structures generated as a result of the work of the previous node.

### **Operations With Nodes** <a href="#operations-with-nodes" id="operations-with-nodes"></a>

The following operations can be performed over the flow nodes:

1. **Add nodes**.

* Click on the required node on the vertical panel and drag it to the workspace. Place the node on the desired connection arrow or empty workspace.
* Click on the arrow connecting nodes, then click on the emerged “plus” and select a desired node on the node panel. It will be added into the flow instead of “plus”.

<figure><img src="https://processmix.com/wp-content/uploads/2023/09/image-210-1-978x1024.png.webp" alt="" width="375"><figcaption></figcaption></figure>

2. **Move nodes**. Click on the required node on the ADE and drag it to the workspace.
3. **Connect nodes**. Click on the connector arrows present in most nodes. When a node is placed on a connector arrow that connects other nodes, the arrow interrupts, and the chain of nodes accepts the moved node if it has no connections with other nodes. All nodes except IN and OUT should have an incoming connection, and all nodes, except OUT, should have an outgoing connection.
4. **Increase/decrease node scale**. Scroll the mouse wheel.

Select **node** on ADE. By clicking the right mouse button, **a** **context menu** opens through which operations are available.

1. **Extract Flow** — allows you to create a new flow by extracting a selected node, which then becomes a Subflow node in the flow you are working on. The newly created flow will include extracted nodes.
2. **Clone** — allows you to create a clone of the node. The cloned node will have a name as the Name of the parent node + Clone(n).
3. **Cut** — allows you to cut nodes for transfer later.
4. **Copy** — allows you to copy the node for transfer later.
5. **Paste** — allows you to paste the node. It is not available unless you have previously used the Copy or Cut options.
6. **Delete** — allows you to delete the node.
7. **Add Breakpoint** – allows you to check the received values in a certain place in the flow during the [debugging process](https://processmix.gitbook.io/guide/ide/debug).
8. **Remove Breakpoint** – allows you to remove Breakpoint from the node. It is not available unless you have previously added Breakpoints to your flow.
9. **Switch Connections (for “If “node only)** – allows you to switch Yes and No connections. This function is not available for the group of nodes.

You can do the same operation with the group of nodes. To select the necessary nodes, press Alt (Windows) or Option (Mac) and select the area of nodes, then click the right mouse button to open the context menu.

<figure><img src="https://processmix.com/wp-content/uploads/2023/09/Flow-component_contextMenu-596x1024.jpg.webp" alt="" width="375"><figcaption></figcaption></figure>

### **Operations With a Flow** <a href="#operations-with-flow" id="operations-with-flow"></a>

Select **Flow** in the left-hand panel of the project explorer. By clicking the right mouse button, a context menu opens through which operations are available.

Let’s see what commands are available in it:

<figure><img src="https://processmix.com/wp-content/uploads/2023/09/Flow-component_4-738x1024.png.webp" alt="" width="375"><figcaption></figcaption></figure>

1. **Edit or double click on the name of the flow** — allows you to open the Flow Builder with the properties of the flow. The flow will open in a new tab.
2. **Copy** — allows you to copy the flow for transfer it later.
3. **Clone** — allows you to create a clone of the flow. The cloned flow will have a name as the Name of the parent flow + Clone(n).
4. **Cut** — allows you to cut flow for transfer later.
5. **Paste** — allows you to paste flow. Is not available unless you have previously used the Copy or Cut options.
6. **Rename** — allows you to rename the flow.
7. **Delete** — allows you to delete the flow.

## Keyboard Shortcuts for Tab Navigation <a href="#available-shortcuts-for-tab" id="available-shortcuts-for-tab"></a>

ctrl+q = move to the previously opened tab

ctrl+e = close current tab

## Keyboard Shortcuts for Project Elements <a href="#available-shortcuts-for-ide-elements" id="available-shortcuts-for-ide-elements"></a>

The table contains possible shortcut actions with project elements.

<table data-header-hidden><thead><tr><th width="76.33333333333331"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>N</strong></td><td>Element</td><td><strong>Actions</strong></td></tr><tr><td>1</td><td>folder</td><td>copy, clone, cut, paste, rename, delete</td></tr><tr><td>2</td><td>flow</td><td>edit, copy, clone, cut, paste, rename, delete</td></tr><tr><td>3</td><td>flow node (ADE)</td><td>clone, cut, copy, delete</td></tr><tr><td>4</td><td>flow input/local variable/request parameters (rest flow)/path parameters (rest flow)</td><td>clone, delete</td></tr></tbody></table>

On a Windows platform, the keyboard shortcuts are:

* Edit = enter
* Copy = ctrl+c
* Paste = ctrl+v
* Cut = ctrl+x
* Rename = ctr+r
* Clone = ctrl+d
* Delete = backspace

One a Mac platform, the keyboard shortcuts are:

* Edit = enter
* Copy =command
* Paste = command-v
* Cut = command-x
* Rename = command-r
* Clone = command-d
* Delete =delete
