> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/wizard-editor/widget/mapping.md).

# マッピング

## 概要

マッピングは、異なるコネクタ間でデータの紐づけを行うためのウィジェットです。\
以下の例では、HubSpotとSalesforceのフィールドの紐づけを行っています。

<figure><img src="https://files.readme.io/4925bf3-image.png" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="success" %}

### ヒント

エンドユーザーは「行を追加」を行うことで、紐づけを行う項目を追加することができます。
{% endhint %}

## 設定方法

ソリューションエディタでエンドユーザー変数を追加し、型は「マッピング」を選択します。

<figure><img src="https://files.readme.io/fdecfaf-image.png" alt="" width="375"><figcaption></figcaption></figure>

作成したエンドユーザー変数をウィザードに割り当てます。

左カラム・右カラムそれぞれに、タイトルや入力方法などを設定できます。

<figure><img src="https://files.readme.io/4951ef3-image.png" alt="" width="563"><figcaption></figcaption></figure>

各カラムの入力方法は [基本的な入力ウィジェット](/wizard-editor/widget.md#nawijetto) から選択できます。

例として、左カラムにSalesforceの取引先フィールドをアシストするように設定する場合は、以下の通りになります。

<figure><img src="https://files.readme.io/41075b1-image.png" alt="" width="188"><figcaption></figcaption></figure>

## 使用例

### Salesforceの新規取引先をHubSpotの会社へ連携する

エンドユーザー変数で「マッピング」を作成します。

ウィザードの設定は以下の通りにします。

**左側：Salesforceの「オブジェクトのフィールド一覧」のアシスト**\
**右側：HubSpotの「企業情報読み込み可能フィールド一覧」のアシスト**

<figure><img src="https://files.readme.io/72a6242-image.png" alt="" width="375"><figcaption></figcaption></figure>

ソリューションのトリガーにSalesforceを設定します。

「レコードが作成/更新された際に実行」で、「取引先」オブジェクトを設定します。

<figure><img src="https://files.readme.io/550ea60-image.png" alt="" width="563"><figcaption></figcaption></figure>

「変数を作成」アクションで「取引先名」という変数を追加します。

変数の値は、[Formulaモード](/solution-editor/common-specs/formula.md)で`{レコード}.get("Name")`とします。

<figure><img src="https://files.readme.io/e64983b-image.png" alt="" width="563"><figcaption></figcaption></figure>

次にHubSpotのカスタムアクションを追加し、既に同一の会社名がないかを検索します。

<figure><img src="https://files.readme.io/a652a77-image.png" alt="" width="563"><figcaption></figcaption></figure>

<table><thead><tr><th width="286.68359375">項目名</th><th width="303.7734375">内容</th></tr></thead><tbody><tr><td>カスタムアクション名</td><td>会社情報を検索</td></tr><tr><td>HTTPメソッド</td><td>POST</td></tr><tr><td>リクエストパス</td><td>/crm/v3/objects/companies/search</td></tr><tr><td>リクエストURLパラメーター</td><td>設定不要</td></tr><tr><td>リクエストヘッダー</td><td>設定不要</td></tr><tr><td>リクエストタイプ</td><td>json</td></tr><tr><td>リクエストボディの入力方法</td><td>デフォルト</td></tr></tbody></table>

リクエストボディ定義：以下をJSONで追加します。

```json
{
    "limit": 20,
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName": "",
            "operator": "",
            "value": ""
          }
        ]
      }
    ]
}
```

リストは「[固定リスト](/solution-editor/common-specs/fixed-list-dynamic-list.md)」にします。

<figure><img src="https://files.readme.io/5e0d583-image.png" alt="" width="375"><figcaption></figcaption></figure>

入力値は以下を設定します。

limit : 20\
propertyName :name\
operator : EQ\
value : {取引先名} ※Step2で作成した変数

<figure><img src="https://files.readme.io/5dd6261-image.png" alt="" width="375"><figcaption></figcaption></figure>

レスポンスボディ定義：以下をJSONで追加します。

```json
{
    "total": 0,
    "results": [
        {
            "id": "",
            "properties": {
                "name": ""
            }
        }
    ]
}
```

[ifステップ](/solution-editor/logic/if.md)を追加し、同一の会社名がない（検索結果が0件）の場合のみに実行する条件を作成します。

<figure><img src="https://files.readme.io/55c7da4-image.png" alt="" width="563"><figcaption></figcaption></figure>

HubSpotの企業情報を作成アクションを、ifがYesの場合に実行されるように設定します。

<figure><img src="https://files.readme.io/536d7c5-image.png" alt="" width="563"><figcaption></figcaption></figure>

リストソースに**マッピング型のエンドユーザー変数**を設定することで\
エンドユーザーが設定したマッピングの行数だけ、プロパティをセットすることができます。

<figure><img src="https://files.readme.io/17467ca-image.png" alt="エンドユーザーはマッピングを自由に追加できる" width="400"><figcaption><p>エンドユーザーはマッピング行数を自由に追加できる</p></figcaption></figure>

プロパティの設定では、`i番目のelement` から選択を行います。

<figure><img src="https://files.readme.io/e3e6ecc-image.png" alt="" width="563"><figcaption></figcaption></figure>

プロパティ名：`{ 左カラム }`

値：`{ Salesforce レコード }.get( { 左カラム } )`

を設定します。

これにより、

**マッピングの右側で設定した「HubSpotのプロパティ」に**

**マッピングの左側で設定した「Salesforceのプロパティ」が持つ値**

を書き込むことができます。

{% hint style="success" %}

### ヒント

HubSpotで会社レコードを作成する場合は `会社名（name）` が**必須**となります。\
このような場合、[デフォルト値を指定](/wizard-editor/advanced-setting/default-value.md)しておくことで、あらかじめ会社名がマッピングの行に含まれた状態で表示できます。
{% endhint %}


---

# 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-embed.anyflow.jp/wizard-editor/widget/mapping.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.
