# Examples snippets

Unpublished/missing examples for the reference pages.

## Examples - Triggers

You can learn more about using Triggers from the following examples.

<details>

<summary>How to create a Process</summary>

Integration flows in Frends are referred to as Processes. Processes consist of elements such as Triggers, Tasks, Subprocesses, decisions and loops. Processes are created by connecting elements together and configuring their parameters.

## Step by Step Tutorial Available

If you prefer more visual or interactive guidance on how to create Processes with Frends, you can find a step-by-step walkthrough from your own environment's home page, under Onboarding by selecting "Tutorial 1, Step 3: Creating my first Process" tutorial.

## Creating New Process

The Process list displays the already created Processes in the Environment.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/Q2S6hlzF2eBazKFuwq9I" alt="The view shows a list of Processes within Frends."><figcaption><p>Example view of Process list.</p></figcaption></figure>

In order to create a new Process, click on **Create New** button while in Process list view and having the Development Environment selected. All new Processes have to be created and edited in the Development Environment, from where they are then deployed to other Environments and Agent Groups for execution.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/nTn2qmlVQgdJf7GtFyqG" alt="Showing where and how to create a new Process."><figcaption><p>Integrations can be created from Process list view while having Development Environment selected.</p></figcaption></figure>

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/RbhoKL4S2bl8O1PrE5td" alt="Default view in Process Editor, when starting to create a new Process."><figcaption><p>Process Editor for a new Process.</p></figcaption></figure>

When creating a new Process, you can start by providing the Process a name and optionally a description. To use the latest versions in Frends, targeting .NET 8 is recommended, while .NET Framework 4.7.1 or .NET Standard 2.0 are only used to support legacy environments.

As an example, let's create a Process which is started manually without parameters, calls an API endpoint and then returns a result. Because the start element, called **Trigger**, is already provided, we can continue forward by adding a **Task** to the process.

You can drag or click and place the Task shape from the leftside toolbar to right of the Trigger shape.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/VZr1I5zp3TaeRkh44FVn" alt="Image shows where to select a Task shape and insert it to the canvas."><figcaption><p>Adding a Task shape to the Process.</p></figcaption></figure>

To make the Task perform an API call, click on the **Select a Task** field and search and select **HTTP Request** Task. When the Task type is selected, the right sidebar contents change to show the Task parameters. In here, enter the url as **<https://examplecrm.frends.com/api/customers>** and make sure Method is GET. Rest of the options can be left as-is for this example.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/nuGbx5hySjCn02XQHN0p" alt="This image shows the parameters for the chosen Task, to perform an API call."><figcaption><p>Parameters for the Task can be set after selecting its type.</p></figcaption></figure>

Once the Task is configured for our use, we need to connect it to the earlier shape. To do this, click on the **Connect tool** from the left toolbar or from the quick toolbar next to the Trigger shape, and draw an arrow from the Trigger to the Task shape.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/IRzSriaccYPinQleJzy3" alt="Here we show how to find and use Connect tool to connect shapes together."><figcaption><p>Draw a connection from the Trigger to Task using the Connect tool.</p></figcaption></figure>

Finally, we need to end the Process and save it. All Processes start with a Trigger, and end to a **Return shape**, or optionally to a **Throw** shape. Let's drag a Return shape to the right side of the Task, and connect it to the Task shape to create a complete Process flow.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/baKae0Iv9S6t2s7LVYDA" alt="Image showing a completed Process flow, with Return shape parameters."><figcaption><p>Complete integration flow with return value.</p></figcaption></figure>

For the example, we want to return the API response's body. We can do this by selecting the Return shape, and writing **#result\[HTTP Request].Body** to the Expression field. Make sure the field's type is set to **Expression,** and not **Text**, in order to Frends consider the content as C# code and not  text.&#x20;

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/i8iq2HX9qXaXqvaxtvUl" alt="Utilizing the Auto-complete feature makes Process development faster."><figcaption><p>Utilize the provided Auto-complete feature to fill in variable names and result objects' names quicker.</p></figcaption></figure>

{% hint style="info" %}
We will cover the C# expressions and other programming features of Frends later on in the guides, but you can  also [check out our guide about Expressions in Frends](/guides/development/using-expressions-in-frends-processes.md) already to learn more right from the start.
{% endhint %}

Once ready, we can **validate** and **save** the process. You can optionally provide a **Description** or a comment to version history, what was changed in this version. It's recommended to always include a short comment on what was done.&#x20;

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/KZRloWPQuOIooovocY4u" alt="Saving and validating the Process is done at the bottom of the editor."><figcaption><p>Saving and validating the Process is done at the bottom of the editor.</p></figcaption></figure>

Validation at this point means that the Process is taken through C# compiler and checked for errors, but it does not save the Process in any way. To save the Process for testing and deployment, select **Create new Process**. Saving the Process also validates it for errors, but save is not done if any errors persist.

When editing a Process, the save button changes to **Save changes**. If you want to save your Process but not create a new version for use yet, you can instead select **Create new draft** from the small arrow menu. This way you can save your work even if the Process is not yet valid.

Once the saving and validation succeeds, you are taken back to Process list view with your new Process highlighted at the top of the list. From there, you can run it, deploy it or continue editing, among other options.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/osrkGQ2RRK3mrS3NpHHX" alt="New Process hightlighted at the top of the Process list, with options for the Process shown."><figcaption><p>New Process hightlighted at the top of the Process list, with options for the Process shown.</p></figcaption></figure>

</details>

<details>

<summary>How to enable manual execution for an API Process</summary>

Adding manual trigger to API process, checking for trigger type, configuring parameters.

</details>

<details>

<summary>How to create and use conditional trigger</summary>

Creating subprocess for conditional trigger, configuring parameters for the trigger, how to use the result value from trigger.

</details>

<details>

<summary>How to create a Subprocess</summary>

Manual trigger parameters, trigger reference value usage.

</details>

<details>

<summary>How to run Process every 5 minutes</summary>

Schedule trigger configuration options, trigger ref value usage.

</details>

## Examples - Return

You can learn more about using Return shape from the following examples.

<details>

<summary>How to create a Process</summary>

Integration flows in Frends are referred to as Processes. Processes consist of elements such as Triggers, Tasks, Subprocesses, decisions and loops. Processes are created by connecting elements together and configuring their parameters.

## Step by Step Tutorial Available

If you prefer more visual or interactive guidance on how to create Processes with Frends, you can find a step-by-step walkthrough from your own environment's home page, under Onboarding by selecting "Tutorial 1, Step 3: Creating my first Process" tutorial.

## Creating New Process

The Process list displays the already created Processes in the Environment.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/Q2S6hlzF2eBazKFuwq9I" alt="The view shows a list of Processes within Frends."><figcaption><p>Example view of Process list.</p></figcaption></figure>

In order to create a new Process, click on **Create New** button while in Process list view and having the Development Environment selected. All new Processes have to be created and edited in the Development Environment, from where they are then deployed to other Environments and Agent Groups for execution.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/nTn2qmlVQgdJf7GtFyqG" alt="Showing where and how to create a new Process."><figcaption><p>Integrations can be created from Process list view while having Development Environment selected.</p></figcaption></figure>

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/RbhoKL4S2bl8O1PrE5td" alt="Default view in Process Editor, when starting to create a new Process."><figcaption><p>Process Editor for a new Process.</p></figcaption></figure>

When creating a new Process, you can start by providing the Process a name and optionally a description. To use the latest versions in Frends, targeting .NET 8 is recommended, while .NET Framework 4.7.1 or .NET Standard 2.0 are only used to support legacy environments.

As an example, let's create a Process which is started manually without parameters, calls an API endpoint and then returns a result. Because the start element, called **Trigger**, is already provided, we can continue forward by adding a **Task** to the process.

You can drag or click and place the Task shape from the leftside toolbar to right of the Trigger shape.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/VZr1I5zp3TaeRkh44FVn" alt="Image shows where to select a Task shape and insert it to the canvas."><figcaption><p>Adding a Task shape to the Process.</p></figcaption></figure>

To make the Task perform an API call, click on the **Select a Task** field and search and select **HTTP Request** Task. When the Task type is selected, the right sidebar contents change to show the Task parameters. In here, enter the url as **<https://examplecrm.frends.com/api/customers>** and make sure Method is GET. Rest of the options can be left as-is for this example.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/nuGbx5hySjCn02XQHN0p" alt="This image shows the parameters for the chosen Task, to perform an API call."><figcaption><p>Parameters for the Task can be set after selecting its type.</p></figcaption></figure>

Once the Task is configured for our use, we need to connect it to the earlier shape. To do this, click on the **Connect tool** from the left toolbar or from the quick toolbar next to the Trigger shape, and draw an arrow from the Trigger to the Task shape.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/IRzSriaccYPinQleJzy3" alt="Here we show how to find and use Connect tool to connect shapes together."><figcaption><p>Draw a connection from the Trigger to Task using the Connect tool.</p></figcaption></figure>

Finally, we need to end the Process and save it. All Processes start with a Trigger, and end to a **Return shape**, or optionally to a **Throw** shape. Let's drag a Return shape to the right side of the Task, and connect it to the Task shape to create a complete Process flow.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/baKae0Iv9S6t2s7LVYDA" alt="Image showing a completed Process flow, with Return shape parameters."><figcaption><p>Complete integration flow with return value.</p></figcaption></figure>

For the example, we want to return the API response's body. We can do this by selecting the Return shape, and writing **#result\[HTTP Request].Body** to the Expression field. Make sure the field's type is set to **Expression,** and not **Text**, in order to Frends consider the content as C# code and not  text.&#x20;

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/i8iq2HX9qXaXqvaxtvUl" alt="Utilizing the Auto-complete feature makes Process development faster."><figcaption><p>Utilize the provided Auto-complete feature to fill in variable names and result objects' names quicker.</p></figcaption></figure>

{% hint style="info" %}
We will cover the C# expressions and other programming features of Frends later on in the guides, but you can  also [check out our guide about Expressions in Frends](/guides/development/using-expressions-in-frends-processes.md) already to learn more right from the start.
{% endhint %}

Once ready, we can **validate** and **save** the process. You can optionally provide a **Description** or a comment to version history, what was changed in this version. It's recommended to always include a short comment on what was done.&#x20;

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/KZRloWPQuOIooovocY4u" alt="Saving and validating the Process is done at the bottom of the editor."><figcaption><p>Saving and validating the Process is done at the bottom of the editor.</p></figcaption></figure>

Validation at this point means that the Process is taken through C# compiler and checked for errors, but it does not save the Process in any way. To save the Process for testing and deployment, select **Create new Process**. Saving the Process also validates it for errors, but save is not done if any errors persist.

When editing a Process, the save button changes to **Save changes**. If you want to save your Process but not create a new version for use yet, you can instead select **Create new draft** from the small arrow menu. This way you can save your work even if the Process is not yet valid.

Once the saving and validation succeeds, you are taken back to Process list view with your new Process highlighted at the top of the list. From there, you can run it, deploy it or continue editing, among other options.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/osrkGQ2RRK3mrS3NpHHX" alt="New Process hightlighted at the top of the Process list, with options for the Process shown."><figcaption><p>New Process hightlighted at the top of the Process list, with options for the Process shown.</p></figcaption></figure>

</details>

<details>

<summary>How to create an API Process</summary>

HTTP response creation.

</details>

<details>

<summary>How to use Scope shape</summary>

Returning a value from a scope.

</details>

<details>

<summary>How to create a Subprocess</summary>

Returning a value from a subprocess

</details>

<details>

<summary>How to create and use Conditional Trigger</summary>

Returning a value from the conditional trigger subprocess.

</details>

## Examples - Intermediate Return

Here are some examples to learn more about using Intermediate Return shape.

<details>

<summary>How to use Intermediate Return shape</summary>

Basics of intermediate return usage and configuration

</details>

<details>

<summary>How to create asynchronous API Process</summary>

API process creation, intermediate return shape usage, sending a response as new http request.

</details>

## Examples - Throw

Here are some examples to learn more about using Throw shape.

<details>

<summary>How to interrupt iteration</summary>

Using throw

</details>

<details>

<summary>How to log error to Frends Process Instances</summary>

Throwing error from process

</details>

<details>

<summary>How to use Subprocess for catching unhandled errors</summary>

If error is raised or thrown, how to handle it.

</details>

<details>

<summary>How to handle errors effectively within Processes</summary>

</details>

## Examples - Catch

Here are some examples to learn more about using Catch shape.

<details>

<summary>How to handle errors within iteration</summary>

Scope and catch within iteration

</details>

<details>

<summary>How to handle errors effectively within Processes</summary>

Default error handling scheme

</details>

<details>

<summary>How to handle errors for single Tasks</summary>

Minimized version of error handling.

</details>

## Examples - Exclusive Decision

You can learn more about using Exclusive Decision shape from the following examples.

<details>

<summary>How to use conditions within Processes</summary>

</details>

## Examples - Inclusive Decision

You can learn more about using Inclusive Decision shape from the following examples.

<details>

<summary>How to use conditions within Processes</summary>

</details>

## Examples - Task

You can learn more about Task shapes from the following guides and examples.

<details>

<summary>How to create a Process with Frends</summary>

Integration flows in Frends are referred to as Processes. Processes consist of elements such as Triggers, Tasks, Subprocesses, decisions and loops. Processes are created by connecting elements together and configuring their parameters.

## Step by Step Tutorial Available

If you prefer more visual or interactive guidance on how to create Processes with Frends, you can find a step-by-step walkthrough from your own environment's home page, under Onboarding by selecting "Tutorial 1, Step 3: Creating my first Process" tutorial.

## Creating New Process

The Process list displays the already created Processes in the Environment.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/Q2S6hlzF2eBazKFuwq9I" alt="The view shows a list of Processes within Frends."><figcaption><p>Example view of Process list.</p></figcaption></figure>

In order to create a new Process, click on **Create New** button while in Process list view and having the Development Environment selected. All new Processes have to be created and edited in the Development Environment, from where they are then deployed to other Environments and Agent Groups for execution.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/nTn2qmlVQgdJf7GtFyqG" alt="Showing where and how to create a new Process."><figcaption><p>Integrations can be created from Process list view while having Development Environment selected.</p></figcaption></figure>

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/RbhoKL4S2bl8O1PrE5td" alt="Default view in Process Editor, when starting to create a new Process."><figcaption><p>Process Editor for a new Process.</p></figcaption></figure>

When creating a new Process, you can start by providing the Process a name and optionally a description. To use the latest versions in Frends, targeting .NET 8 is recommended, while .NET Framework 4.7.1 or .NET Standard 2.0 are only used to support legacy environments.

As an example, let's create a Process which is started manually without parameters, calls an API endpoint and then returns a result. Because the start element, called **Trigger**, is already provided, we can continue forward by adding a **Task** to the process.

You can drag or click and place the Task shape from the leftside toolbar to right of the Trigger shape.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/VZr1I5zp3TaeRkh44FVn" alt="Image shows where to select a Task shape and insert it to the canvas."><figcaption><p>Adding a Task shape to the Process.</p></figcaption></figure>

To make the Task perform an API call, click on the **Select a Task** field and search and select **HTTP Request** Task. When the Task type is selected, the right sidebar contents change to show the Task parameters. In here, enter the url as **<https://examplecrm.frends.com/api/customers>** and make sure Method is GET. Rest of the options can be left as-is for this example.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/nuGbx5hySjCn02XQHN0p" alt="This image shows the parameters for the chosen Task, to perform an API call."><figcaption><p>Parameters for the Task can be set after selecting its type.</p></figcaption></figure>

Once the Task is configured for our use, we need to connect it to the earlier shape. To do this, click on the **Connect tool** from the left toolbar or from the quick toolbar next to the Trigger shape, and draw an arrow from the Trigger to the Task shape.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/IRzSriaccYPinQleJzy3" alt="Here we show how to find and use Connect tool to connect shapes together."><figcaption><p>Draw a connection from the Trigger to Task using the Connect tool.</p></figcaption></figure>

Finally, we need to end the Process and save it. All Processes start with a Trigger, and end to a **Return shape**, or optionally to a **Throw** shape. Let's drag a Return shape to the right side of the Task, and connect it to the Task shape to create a complete Process flow.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/baKae0Iv9S6t2s7LVYDA" alt="Image showing a completed Process flow, with Return shape parameters."><figcaption><p>Complete integration flow with return value.</p></figcaption></figure>

For the example, we want to return the API response's body. We can do this by selecting the Return shape, and writing **#result\[HTTP Request].Body** to the Expression field. Make sure the field's type is set to **Expression,** and not **Text**, in order to Frends consider the content as C# code and not  text.&#x20;

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/i8iq2HX9qXaXqvaxtvUl" alt="Utilizing the Auto-complete feature makes Process development faster."><figcaption><p>Utilize the provided Auto-complete feature to fill in variable names and result objects' names quicker.</p></figcaption></figure>

{% hint style="info" %}
We will cover the C# expressions and other programming features of Frends later on in the guides, but you can  also [check out our guide about Expressions in Frends](/guides/development/using-expressions-in-frends-processes.md) already to learn more right from the start.
{% endhint %}

Once ready, we can **validate** and **save** the process. You can optionally provide a **Description** or a comment to version history, what was changed in this version. It's recommended to always include a short comment on what was done.&#x20;

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/KZRloWPQuOIooovocY4u" alt="Saving and validating the Process is done at the bottom of the editor."><figcaption><p>Saving and validating the Process is done at the bottom of the editor.</p></figcaption></figure>

Validation at this point means that the Process is taken through C# compiler and checked for errors, but it does not save the Process in any way. To save the Process for testing and deployment, select **Create new Process**. Saving the Process also validates it for errors, but save is not done if any errors persist.

When editing a Process, the save button changes to **Save changes**. If you want to save your Process but not create a new version for use yet, you can instead select **Create new draft** from the small arrow menu. This way you can save your work even if the Process is not yet valid.

Once the saving and validation succeeds, you are taken back to Process list view with your new Process highlighted at the top of the list. From there, you can run it, deploy it or continue editing, among other options.

<figure><img src="/spaces/0p415NUmUmiF4ayjI81L/files/osrkGQ2RRK3mrS3NpHHX" alt="New Process hightlighted at the top of the Process list, with options for the Process shown."><figcaption><p>New Process hightlighted at the top of the Process list, with options for the Process shown.</p></figcaption></figure>

</details>

<details>

<summary>How to create a Subprocess</summary>

</details>

<details>

<summary>Using a database in Processes</summary>

</details>

<details>

<summary>How to create your own Task</summary>

</details>

## Examples - Call Subprocess

You can learn more about Call Subprocess shape from the following guides and examples.

<details>

<summary>How to create a Subprocess</summary>

</details>

<details>

<summary>How to use a Subprocess in Processes</summary>

</details>

<details>

<summary>How to access internal resources from public API</summary>

</details>

## Examples - Assign Variable

You can learn more about Assign Variable shape from the following guides and examples.

<details>

<summary>How to create and use variables in Processes</summary>

</details>

<details>

<summary>Data types in Frends Processes</summary>

</details>

## Examples - Code Task

You can learn more about Code Task shape from the following guides and examples.

<details>

<summary>How to create and use variables in Processes</summary>

</details>

<details>

<summary>Data types in Frends Processes</summary>

</details>

## Examples - Shared State Task

You can learn more about Shared State Task from the following guides and examples.

<details>

<summary>How to store an authentication token to cache</summary>

</details>

<details>

<summary>Performing execution lock in Frends Processes</summary>

</details>

## Examples - DMN Task

You can learn more about DMN Task shape from the following guides and examples.

<details>

<summary>How to use DMN in a Process</summary>

</details>

## Examples - AI Connector

You can learn more about AI Connector from the following guides and examples.

<details>

<summary>How to use AI as part of your Process</summary>

</details>

## Examples - Scope

You can learn more about Scope shape from the following guides and examples.

<details>

<summary>How to handle errors in Processes</summary>

</details>

## Examples - Foreach

You can learn more about Foreach shape from the following guides and examples.

<details>

<summary>How to iterate through all rows of a dataset</summary>

</details>

## Examples - While

You can learn more about While shape from the following guides and examples.

<details>

<summary>How to iterate until operation is a success</summary>

</details>

## Examples - File Trigger

You can learn more about File Trigger from the following guides and examples.

<details>

<summary></summary>

</details>

## Examples - Schedule Trigger

You can learn more about Schedule Trigger from the following guides and examples.

<details>

<summary>How to run a process automatically</summary>

</details>

## Examples - Conditional Trigger

You can learn more about Conditional Trigger from the following guides and examples.

<details>

<summary>How to use complex criteria for starting a Process</summary>

</details>

## Examples - HTTP Trigger

You can learn more about HTTP Trigger from the following guides and examples.

<details>

<summary>How to handle HTTP requests with Frends</summary>

</details>

## Examples - API Trigger

You can learn more about API Trigger from the following guides and examples.

<details>

<summary>How to handle HTTP requests with Frends</summary>

</details>

<details>

<summary>Creating API with Frends</summary>

</details>

## Examples - AMQP Trigger

You can learn more about AMQP Trigger from the following guides and examples.

<details>

<summary>How to listen for message queues</summary>

</details>

## Examples - Service Bus Trigger

You can learn more about Service Bus Trigger from the following guides and examples.

<details>

<summary>How to listen for message queues</summary>

</details>

## Examples - RabbitMQ Trigger

You can learn more about RabbitMQ Trigger from the following guides and examples.

<details>

<summary>How to listen for message queues</summary>

</details>

## Examples - Azure Event Hub Trigger

You can learn more about Azure Event Hub Trigger from the following guides and examples.

<details>

<summary>How to listen for message queues</summary>

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.frends.com/reference/frends-6.1.0/examples-snippets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
