# Creating a Value Stream

Using the Value Streams dashboard, you can create, edit, and monitor your processes. The value streams are made up of a combination of triggers and process steps. It is required to have at least one trigger in a value stream.

## Prerequisite

Before starting to build your value stream, get familiarized with the concept of the building blocks and how they work. See the [Value Stream Components](https://developer.emporix.io/value-stream-modeller/value-stream-designer/process-components) guide.

## Building a process - simple flow

The example shows how to build a basic flow with Value Stream Modeller.

{% stepper %}
{% step %}

#### Choose to create a value stream

Go to the Value Streams dashboard and choose **Create Value Stream**. The process creation is initiated, allowing you to either select **Start from a Template** or **Start from Scratch** for the design.

* If you choose **Start from a Template**, you can select the process template from the ones available in the [Value Stream Library](https://developer.emporix.io/value-stream-modeller/value-stream-library/pl-introduction). You can adjust the process to your needs based on the defined template triggers and steps.
* If you choose **Start from Scratch**, you start your configuration with no configured triggers or steps.

The next steps follow the **Start from Scratch** process creation.
{% endstep %}

{% step %}

#### Add a process name

After choosing **Start from Scratch**, add a **Value Stream Name** and a **Description** for the process. The name is required for the process. The description is optional, but recommended as it may help you identify your processes when their number rises.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-5bb9aa0287d02683168a6302880de1f3e67d6487%2Fstart_config.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Choose a process trigger

Every process begins with a trigger event that starts the entire flow. A pre-configured list of events is available out-of-the-box to choose from. For example, the registration of a new customer can serve as such a trigger. The starting trigger can be both a CE event related to any commerce operation, or a custom event created in your tenant.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-2d37a51ae16f40baeb6887e5f44a6dd5ad82caaa%2Fprocess_trigger.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Add a process step

Once the trigger is defined, you can configure the subsequent steps in the workflow by selecting them from a list of available process actions. Use them to build the flow according to your business requirements. To start creating a new step, the **add** icon and then **step**.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-9e69bc2f542fc7d2d6fe5d9dfc2e9327a2f6d103%2Fprocess_step.png?alt=media" alt=""><figcaption></figcaption></figure>

* **Option 1: Add a Scenario**

  From the step type list, select **Scenario** - it represents an action to happen. For example, when a new customer is created you want to welcome them with an email with some first account information. In that case, you use a scenario build for your tenant.

  Decide whether to use a fixed scenario (a predefined setup) or a configurable one (one that allows further adjustments).

  Save your selection to include the scenario in your process.
* **Option 2: Add a Subflow**

  Select **Subflow** as the step type. From the drop-down list, choose one of the value streams already available in your tenant. For example, add a subflow that sends a coupon together with the welcome email for new customers.

  Save your selection to include the scenario in your process.
* **Option 3: Add an AI Agent**

  Choose an AI Agent as the step type. Select the agent that fits your value stream or business need. Available agents include:

  * Anti-Fraud Agent – detect and prevent fraudulent actions
  * Complaint Agent – handle customer complaints
  * Support Agent – assist with customer requests or questions
  * Translation Agent – automatically translate content

  Configure the agent name, description and prompt as needed and save the step.
  {% endstep %}
  {% endstepper %}

Whenever you want to remove a trigger or a process step, you can do so directly in the relevant block by choosing the **Remove** action under the three dots icon.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-2f1a274d88bac4d977a8f124d1043ff485de39ce%2Fstep_removal.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Scenarios, subflows and triggers are normally predefined and are used directly within the Value Stream Modeler to build and execute process flows. They are set up using the Orchestration Engine and Make. For more detailed and technical information how they are configured and prepared, see the Orchestration Engine documentation:

* [Understanding Make](https://app.gitbook.com/s/8dAaH7DfB59pzZwLxmur/getting-started/understanding-make)
* [Value Stream Components](https://app.gitbook.com/s/8dAaH7DfB59pzZwLxmur/value-streams/working-with-value-streams/value-streams-components)
* [Creating a Value Stream - Triggers](https://app.gitbook.com/s/8dAaH7DfB59pzZwLxmur/value-streams/working-with-value-streams/creating-value-streams#triggers)
* [Creating a Value Stream - Process Steps](https://app.gitbook.com/s/8dAaH7DfB59pzZwLxmur/value-streams/working-with-value-streams/creating-value-streams#process-steps)
  {% endhint %}

## A process with multiple triggers

When creating a value stream, you can choose multiple triggers to start your processes. If multiple triggers are defined at the start, only one of them needs to occur for the process to begin. Once an event has been added as a start trigger, it cannot be added again. The triggers can be of a different type, for example a commerce event together with a timer trigger.

To create a process that starts with multiple triggers:

{% stepper %}
{% step %}

#### Add a first trigger in the process

Configure it in the trigger step sidebar.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-089abfa80db63829a05b9e1bd8097aa86fc28829%2Ffirst_trigger.png?alt=media" alt="Adding a first trigger" width="550"><figcaption><p>Adding a first trigger</p></figcaption></figure>
{% endstep %}

{% step %}

#### Add additional triggers for the same process

You can add an additional trigger in two ways—using the three dots icon in the first trigger, or the **Add** icon in the process flow:

* Use the **three dots** icon: Select the three dots icon on the first trigger and choose **Add more triggers**.

  <figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-d85cc17ac1fb5cf0ca34b7de2c6604fecfdfd4a2%2Fmultiple_trigger.png?alt=media" alt="Adding a second trigger" width="550"><figcaption><p>Adding a second trigger</p></figcaption></figure>

  This opens the sidebar, where you can select the trigger step.

  <figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-444d2b08c582caaa43e52f550e39e3feb76b6372%2Fmultiple_trigger1.png?alt=media" alt="Configuring the second trigger" width="550"><figcaption><p>Configuring the second trigger</p></figcaption></figure>
* Use the **Add** button by hovering over: Select the **Add** button in the process flow to open the configuration sidebar. You can only use this option if you have at least two triggers.

  <figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-42dfafd432f3a12f282f2eecd992426b61f3bcd0%2Fmultiple_trigger2.png?alt=media" alt="Adding another trigger in the flow" width="550"><figcaption><p>Adding another trigger in the flow</p></figcaption></figure>

**Result**: After saving, the new trigger is added to the value stream flow and appears under the first starting trigger.

<figure><img src="https://1024162941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrSc4haeKWrTrOPHzdrMO%2Fuploads%2Fgit-blob-a3c7f80798c413de9b335d42673873fb7bf235fb%2Ftriggers.gif?alt=media" alt="Multiple triggers configured"><figcaption><p>Multiple triggers configured</p></figcaption></figure>
{% endstep %}
{% endstepper %}

## Using triggers between process steps

If your value stream needs to pause until a specific event occurs, it can enter a dormant or sleeping state. During this time, the process remains active in the background but does not continue to the next steps until a specific event happens.

To wake up a sleeping process instance, you need to add a trigger that allows the process to continue when the expected event occurs. When setting up such a trigger, you can place it between process steps. However, only custom events can serve as intermediate triggers. This means that if you select an event from the drop-down list to configure the trigger, the CE events are not be visible.

You can add a middle trigger only after adding a step. Triggers cannot follow another trigger directly—only a single trigger or multiple triggers at the same level are supported.

## Process conditions

You can control when and how steps run in three ways: **step filters** (run a step only when the event type matches), **conditional steps** (branch into different paths based on conditions), and **looping** (repeat steps until a condition is met). For how to configure and use each option, see [Conditions](https://developer.emporix.io/value-stream-modeller/value-stream-designer/process-components/conditions).
