> For the complete documentation index, see [llms.txt](https://docs.skyone.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.skyone.cloud/english/skyone-studio/integrations/flows/flow-management/flow-canva-configuring-and-editing-the-flow/multicontext-flows.md).

# Multicontext Flows

"**Multicontext Flows"** allow to use the same flows for several contexts. Each content has its own flow variable values and its own accounts. Through the multicontex flows you can activate the same flow for different partners, clients or users, and specify their own account. It’s a simple way to use the same integration for different entities under the control of a single account.

***

### Definitions <a href="#definitions" id="definitions"></a>

It’s easier to explain the "**Multicontext Flow"** by exemplifying a scenario in which we need to execute the same flow for two different accounts. You can imagine that an integration runs periodically and updates the database of a certain customer. Now think that another client would like to use the same integration, but we need to save the information in the database of this other customer.

Using "**Multicontext Flow"** we can use the same flow to execute the function for both companies. Of course, we will need to indicate to the flow:

* **Context**: In this case, we have a context for each cliente.
* **Context Key**: It’s the variable that allows to identify the context. It can be a client identifier information. With this key we can identify all variables and accounts in the context.
* **Context Variable**: We can create flow variables that are configured by context. In other words, the values of these flow variables are specified for each client individually.
* **Context Accounts**: We can create access accounts (Database, REST API , etc) for each context. In this way, the flow will use the specific accounts of a client when running in that client’s context.

A "**Multicontext Flow"** has at least one "**Context Finder"**. During the execution of the flow we call the "**Context Finder"** by passing a context identification key. The "**Context Finder"** has the goal of locating the context from the provided key. Once found, "**Context Finder"** returns all parameter and account values specific to that context. Subsequent modules can use the context-specific variables and accounts.

<figure><img src="/files/2fFlRw4KqR20fzLs7Xiy" alt=""><figcaption></figcaption></figure>

### **Set up a multicontext flow**

Building a multicontext flow must follow exactly the same steps as a conventional flow. Once tested, the conventional flow can be converted into a multicontext flow.

1. [**\[ Step 01 \]** Build the conventional monocontext flow](#step-01-build-the-conventional-monocontext-flow)
2. [**\[ Step 02 \]** Introduce Context Finder into the flow](#step-02-introduce-context-finder-into-the-flow)
3. [**\[ Step 03 \]** Select the **variables** that should change according to the context](#step-03-select-the-variables-that-should-change-according-to-the-context)
4. [**\[ Step 04 \]** Select the **accounts** that should change according to the context](#step-04-select-the-accounts-that-should-change-according-to-the-context)
5. [**\[ Step 05 \]** Set up the accounts for each context](#step-05-set-up-the-accounts-for-each-context)
6. [**\[ Step 06 \]** Create the contexts and their keys](#step-06-create-the-contexts-and-their-keys)
7. [**\[ Step 07 \]** Configure the flow variables for each context and assign the accounts](#step-07-configure-the-flow-variables-for-each-context-and-assign-the-accounts)
8. [**\[ Step 08 \]** Multicontext flow execution logs](#step-08-multicontext-flow-execution-logs)

***

#### Step by Step

#### <mark style="color:blue;">**Step 01:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">Build the conventional monocontext flow</mark>

Build your flow in the conventional way using the flow variables and accounts as if this flow were to serve only one context.

<figure><img src="/files/x4SdYrIMsDp0u0IRrnFJ" alt=""><figcaption><p>Conventional Monocontext Flow</p></figcaption></figure>

{% hint style="info" %}
You can define a default context. As a suggestion, create the conventional flow with the variables and accounts that will be used by the default context.
{% endhint %}

#### &#x20;<mark style="color:blue;">**Step 02:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">Introduce Context Finder into the flow</mark>

The Context Finder receives a key to find the context. The context contains the set of flow variables and connected accounts that should be used when executing the flow.

Typically the "**Context Finder"** is at the beginning of the flow execution, but it can be located at any position within the flow. It must however be located **before** the modules that use the context dependent flow variables and connected accounts.

It's also important to make sure that the context **key** information is already available so that it can be passed to "**Context Finder"**. Usually this key comes from a [**Webhook Trigger**](/english/skyone-studio/integrations/flows/triggers-of-a-flow/webhook-triggers-adding-and-setting.md) or an API call from the **API Gateway**, but it can come from any module, including a flow variable.

<figure><img src="/files/ZI56oVVZcRURWSQyxkoO" alt=""><figcaption><p>Context Finder Module</p></figcaption></figure>

The "**Context Finder"** module requires the operator to supply only the **key** that will be used to find the context. Specify the variable that will be used as the key in the **Parameter** field.

<figure><img src="/files/w7YVyoQdSR1H64MR1mHG" alt=""><figcaption><p>Context Finder Module - key</p></figcaption></figure>

#### <mark style="color:blue;">**Step 03:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">Select the</mark> <mark style="color:blue;"></mark><mark style="color:blue;">**variables**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">that should change according to the context</mark>

You must define which variables change according to the context.

To indicate that a flow variable is also a context variable, simply edit the variable in **Contexts** → **Variables** → **Add variables**.

<figure><img src="/files/rz77MmjtOj3DVsorw14c" alt=""><figcaption><p>New variable configuration screen</p></figcaption></figure>

Observe that all flow variables created in **Context** are moved to a new tab exclusively for this type of variable, if you view it in **Settings** .

<figure><img src="/files/YACgukl8M0htvvjozHA1" alt=""><figcaption><p>Settings > Variables > Context tab</p></figcaption></figure>

#### <mark style="color:blue;">**Step 04:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">Select the</mark> <mark style="color:blue;"></mark><mark style="color:blue;">**accounts**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">that should change according to the context</mark>

You need to specify the variables that change according to the context. All the accounts of the modules that are executed after the Context Finder can be specified.

{% hint style="warning" %}
Make sure you have inserted "**Context Finder"** in your flow, or you won’t be able to specify context dependent accounts.
{% endhint %}

Revisit the flow you created and open the configuration for modules that require connected accounts, such as Database or REST API modules that **need context specific accounts**.

Observe that these modules now allow you to specify an account associated with a context. Select the option to use context account.

<figure><img src="/files/elAy9Vvg3LMTOETV66XU" alt=""><figcaption><p>Option to use context in this component</p></figcaption></figure>

Once you have made your selection, the **Configure context connected account** option will appear on the screen:

<figure><img src="/files/mH0H4Yuiyg1AB8G7CWST" alt=""><figcaption><p>Configure context connected account</p></figcaption></figure>

{% hint style="info" %}
Skyone Studio uses the original account you created in **STEP 01** and assigns it to the **Default** context.
{% endhint %}

Note that at this point you can create other context accounts, but we'll do that later in this process. You can click "**Next**" to proceed to the module's test page.

<figure><img src="/files/IrcGPIudZjcbKgoMnRa2" alt=""><figcaption></figcaption></figure>

Take note that you can now select the context account to run the test on. Since we have not configured any context so far, only the **Default** account is available.

#### <mark style="color:blue;">**Step 05:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">Set up the accounts for each context</mark>

Access accounts are still set up the same way. You must set up one account for each context. These accounts will later be referenced when editing the context.

{% hint style="info" %}
Todos os tipos de contas disponíveis no **Skyone Studio** podem ser acessadas pelos contextos.
{% endhint %}

<figure><img src="/files/VzSMRNAxG5dgGnIF8zFZ" alt=""><figcaption><p>Regular configuration of accounts</p></figcaption></figure>

#### <mark style="color:blue;">**Step 06:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">Create the contexts and their keys</mark>

There's a specific area for configuring contexts. Each context corresponds to a different entity that has its specific accounts and variables. For example, each context might correspond to a different client with its database access accounts and specific flow variables. In this step, you must create the contexts and define a key that allows you to identify each context, such as a customer identifier.

Select the **"Context"** option in the main flow editing screen.

In Context edit mode you can create, edit and remove contexts. The first time you log in, only the default context (**Default**) is available. You can click "**Add context"** to enter a new context.

<figure><img src="/files/0CIkL6EvjIQkRRavy76I" alt=""><figcaption></figcaption></figure>

When creating a new context you can define a name and a **key** for your context. The name is just a reference for the operator to locate the context. The key is the information that will be used to locate this context. It works as an indexer and must be unique for that flow.<br>

<figure><img src="/files/0m2T8t69nkjBMaIl2fDe" alt=""><figcaption><p>Context Creation - Name and Key Definition</p></figcaption></figure>

When you save this context, you will see it in the list of available contexts.

#### <mark style="color:blue;">**Step 07:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">Configure the flow variables for each context and assign the accounts</mark>

In this step you set up the flow variables and accounts for each context.&#x20;

Click on the editing pencil for the context you want to edit.

<figure><img src="/files/0bpB1fgJCtYey5OIsj5M" alt=""><figcaption><p>Editing context</p></figcaption></figure>

Notice that you will now be able to edit the connected variables and accounts of the selected context. All flow variables that were converted to **Context Parameter** for context variables in **STEP 02** will automatically appear so that you can setup their values.

<figure><img src="/files/V3lmRajHjtKgUzLTdprE" alt=""><figcaption><p>Editing context parameters and accounts</p></figcaption></figure>

In the same way, **Connected Accounts** can also be defined in this step. Click "**Connected Accounts"**.

<figure><img src="/files/sLhK2mb3RspfdI4dTymr" alt=""><figcaption><p>Context Editing - Connected Accounts</p></figcaption></figure>

You can define which account will be used for each of the components that require context-connected accounts. You will have to execute this function for each of the contexts you create.

#### <mark style="color:blue;">**Step 08:**</mark> <mark style="color:blue;"></mark><mark style="color:blue;">Multicontext flow execution logs</mark>

Execute the flow in the same way that you run a conventional flow. Just make sure the key information is correctly provided to "**Context Finder"**.&#x20;

The logs of the multicontext flows have additional information about the context and the values obtained in each execution.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.skyone.cloud/english/skyone-studio/integrations/flows/flow-management/flow-canva-configuring-and-editing-the-flow/multicontext-flows.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
