---
title: Example - CRM and For Each
description: See an integration example with CRM and For Each
documentId: ipaas-legacy-example
locale: en-US
---

See below an example of an integration flow with CRM and For Each.

## Summary

In this example, we have a flow that runs every day at midnight.
It synchronizes product information from ERP with CRM and BI, ensuring that all information is up-to-date and consistent across all systems.
At the end, it sends a notification via Slack.

See the sequence of flow *steps* in the image below:

![flow1.png](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_ac89115824.png)

The flow consists of the following *steps*:

* **Trigger**: Scheduler Trigger
* **Connectors**: SAP 4 Hana, SalesForce, and Slack
* **General tool**: For Each

## Authorizations

To begin, let's **register the authorizations** that will be used:

* **API KEY**

See below how to register the API Key authorization that we will use for the Slack connector:

![flow1-api-key.gif](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_api_key_22786d2904.gif)

* **OAUTH 2 - Client Credentials**

See below how to register the OAUTH 2 - Client Credentials authorization that we will use for the SalesForce connector:

![flow1-auth-client-credentials.gif](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_auth_client_credentials_4db8a9bd19.gif)

<Callout type="note" title="NOTE">
For more details about authorization types, read the documentation about [Authorizations](/docs/integrations/ipaas-authorizations).
</Callout>

## Environment variables

To create the environment variables that will be used in the flow, click the environment variables icon in the left menu of the canvas.

See in the GIF how to register environment variables:

![flow1-env-var.gif](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_env_var_c911faaab1.gif)

<Callout type="note" title="NOTE">
For more information, read the documentation about [Environment Variables](/docs/integrations/ipaas-legacy-variables).
</Callout>

## Steps

Having done this, let's see in more detail how to configure an example of each type of *step*:

**Trigger: Scheduler Trigger**

This *step* will be responsible for initiating the execution of the integration flow, which will happen daily at midnight.

<Steps>
  <Step>
  In the left menu, select **Triggers** and then select **Scheduler Trigger**.
  </Step>
  <Step>
  Fill in the *trigger* name, which in the example will be "Every day at 12 am".
  </Step>
  <Step>
  Insert the corresponding *Cron Expression*. In this case, the expression will be "* * * 0 0".
  </Step>
  <Step>
  Click **Save**.
  </Step>
</Steps>

See the steps in the GIF:

![flow1-scheduler-trigger.gif](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_scheduler_trigger_ca9848c611.gif)

<Callout type="note" title="NOTE">
For more information, read the documentation about [Scheduler Trigger](/docs/integrations/ipaas-legacy-scheduler-trigger).
</Callout>

**General tool: For Each**

After starting the flow and obtaining the product list in the previous *step* "Get Product List", the flow will execute some actions for each product in the list.
The actions executed for each product will be those inside **For Each**.

<Steps>
  <Step>
  In the left menu, select **General Tools** and then select **For Each**.
  </Step>
  <Step>
  Fill in the tool name, which will be "For Each Product" (since actions are performed for each product).
  </Step>
  <Step>
  In the **Variable** field, click **Properties** and select "$.Get_Product_List.Response.Payload.value", which is the response from the previous *step* with the product list.
  </Step>
  <Step>
  In the **Iteration Element** field, fill in the name of the element that will be repeated, which will be "Product List".
  </Step>
  <Step>
  Enable the **Ignore Errors** button.
  </Step>
  <Step>
  Click **SAVE**.
  </Step>
</Steps>

See the steps in the GIF:

![flow1-for-each.gif](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_for_each_30cd75b3eb.gif)

<Callout type="note" title="NOTE">
For more information, read the documentation about [For Each](/docs/integrations/ipaas-legacy-for-each).
</Callout>

**Connector: REST API**

At this stage of the flow, we have already retrieved the product list and description.
Now, we will update the CRM product catalog.

Since we are using a REST API connector, we will configure its payload through the data mapping feature.

<Steps>
  <Step>
  In the left menu, select **Connectors** and search for the **SalesForce** connector.
  </Step>
  <Step>
  Fill in the connector name, which will be "Update CRM Catalog".
  </Step>
  <Step>
  Select the route "POST/Product".
  </Step>
  <Step>
  Insert the URL.
  </Step>
  <Step>
  Keep the **Request Timeout** field with the default value: 3000.
  </Step>
  <Step>
  In the **Security** field, select "Authorization SalesForce".
  </Step>
  <Step>
  Click **Create Data Mapping**.
  </Step>
  <Step>
  In the FROM column, select "$.Get_Description.Response.Payload.value.ProductDescription".
  </Step>
  <Step>
  In the TO column, select "$.Request.Payload.Name".
  </Step>
  <Step>
  Click **ADD MAPPING**.
  </Step>
  <Step>
  Click **CONFIRM**.
  </Step>
  <Step>
  Enable the **Ignore Errors** button.
  </Step>
  <Step>
  Click **SAVE**.
  </Step>
</Steps>

![flow1-update-CRM-catalog.gif](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_update_CRM_catalog_b402e61bf7.gif)

<Callout type="note" title="NOTE">
For more information about this type of connector, read the documentation about [REST API](/docs/integrations/ipaas-legacy-connectors-rest-api) connectors.
</Callout>

**End**

After completing the configuration of all flow *steps*, you must make the connection with the End *step*.

## Test mode

To execute your flow in test mode and check for any errors before deployment, click **TEST MODE**.
Then, click **EXECUTE**.
You can consult the *logs* in [Sensedia Analytics](https://docs.sensedia-eng.com/pt-BR/docs/analytics).

See the steps in the GIF below:

![flow1-test-mode.gif](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_test_mode_cdb33ad998.gif)

<Callout type="note" title="NOTE">
For more information, read the documentation about [Test Mode](/docs/integrations/ipaas-legacy-test-mode).
</Callout>

## Deployment

To deploy your flow, click **DEPLOY**.
Check the information and your flow is ready for deployment.

See the steps in the GIF below:

![flow1-deploy.gif](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_deploy_ff873e6f1b.gif)

<Callout type="note" title="NOTE">
For more information, read the documentation about [Deploy](/docs/integrations/ipaas-legacy/deploy).
</Callout>

## Deployment status and execution logs

To check the deployment status, access the [Deployments](/docs/integrations/ipaas-deployments) page.
You can also view other information such as deployment date and time.

To view execution logs, access the [Executions](/docs/integrations/ipaas-observability-monitoring) page.

By clicking the ![width=24px, height=24px](https://creative-ball-51b3fc85c0.media.strapiapp.com/open_in_new_Icon_4201b7f235.png) icon in the Details column, **Sensedia Analytics** will open.
You can see the request and response *logs* from the connectors and For Each.

See the GIF below:

![flow1-deployments-execution.gif](https://creative-ball-51b3fc85c0.media.strapiapp.com/flow1_deployments_execution_b998b8df38.gif)
