---
schema_version: "1"
id: e1092b67556c86fab5087e11f79894e6ab7d00f7aed1ccf5fd7b4d80145b392c
title: NetSuite Connector 11.10 の例
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/netsuite-connector/11.10/netsuite-examples.md
canonical_url: https://docs.mulesoft.com/jp/netsuite-connector/11.10/netsuite-examples
source_site: docs.mulesoft.com
content_type: documentation
content_hash: ad85b7bc5b978c23e95fe16900dff3c7ae4d6d2b47415b581e139cdf60c68a2b
description: MuleSoft Documentation Site
release: "11.10"
latest: true
---
# NetSuite Connector 11.10 の例

次の例は、NetSuite 用 Anypoint Connector C (NetSuite Connector) で検索を実行する方法を示しています。

- [Integer (整数) 項目によるアカウントの基本検索の絞り込み](#account-basic-search)
    
    内部 ID が ​`internalId`​ クエリパラメーターの値未満のアカウントレコードを取得します。
- [Boolean (ブール値) 項目および String (文字列) 項目による従業員の基本検索の絞り込み](#employee-basic-search)
    
    姓の先頭が指定した文字である非アクティブな従業員レコードを取得します。
- [Date (日付) 項目および Array (配列) 項目による顧客の詳細検索の絞り込み](#customer-advanced-search)
    
    2015 年以降に作成されて LEAD フェーズにある顧客レコードを取得します。

次の例は、NetSuite Connector でファイルを追加する方法を示しています。

- [ファイルの追加](#add-file)
    
    **Add**​ 操作を使用して、ファイルを追加します。

次の例は、NetSuite Connector でカスタム項目およびレコードを使用する方法を示しています。

- [カスタムレコードの追加](#add-custom-record)
    
    カスタム項目を含むカスタムレコードを追加します。
- [カスタムレコードの取得](#get-custom-record)
    
    カスタム項目を含むカスタムレコードを取得します。
- [カスタムレコードの削除](#delete-custom-record)
    
    カスタム項目を含むカスタムレコードを削除します。

## [](#account-basic-search)Integer (整数) 項目によるアカウントの基本検索の絞り込み

この例では、NetSuite Connector の ​`Search`​ 操作を使用して、内部 ID が指定された値未満のアカウントレコードを取得する方法を示します。

この例では、少なくとも 1 件の基本アカウントが NetSuite インスタンスの検索条件を満たしている必要があります。

次のスクリーンショットは、この例の Studio アプリケーションフローを示しています。

![アカウントの基本検索の例のアプリケーションフロー](/mulesoft/current/ja-jp/netsuite-connector/11.10/_images/netsuite-examples-search-account.png)

Figure 1. Studio でのアカウントの基本検索アプリケーションフロー

この例を作成するには、新規 Mule プロジェクトを作成し、​`HTTP Listener`​、NetSuite Connector の ​`Search`​ 操作、1 つの ​`For Each`​ コンポーネント、2 つの ​`Transform Message`​ コンポーネントを設定する必要があります。

### [](#http-リスナーを設定する)HTTP リスナーを設定する

ローカルホストポート 8081 で ​`/account`​ パスへのコールが行われたときに Mule フローを開始するように HTTP リスナーを設定します。

1. Studio で新しい Mule プロジェクトを作成します。
2. Studio で ​**\[HTTP\]**​ をクリックし、​**\[Listener\]**​ 操作をキャンバスにドラッグします。
3. **Listener**​ 操作の表示名を ​`/account`​ に変更します。
4. \[Listener\] プロパティウィンドウで、​**\[Connector configuration (コネクタ設定)\]**​ 項目の横にある ​**\[+\]**​ をクリックしてグローバル要素を追加します。
5. デフォルトを受け入れます。
6. \[Listener\] プロパティウィンドウで、​**\[Path (パス)\]**​ 項目値を ​`/account`​ に設定します。

### [](#最初の-transform-message-コンポーネントを追加する)最初の \[Transform Message\] コンポーネントを追加する

この ​**\[Transform Message\]**​ コンポーネントには、フローの検索条件が含まれています。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[Transform Message\]**​ コンポーネントを ​**\[Listener\]**​ の右側にドラッグします。
2. **\[Transform Message\]**​ コンポーネントの名前を ​`Search Criteria`​ に変更します。
3. **\[Transform Message\]**​ コンポーネントをクリックします。
    
    **\[Output (出力)\]**​ 列には ​**AccountSearchBasic**​ オブジェクトのメタデータが表示されます。そこから条件をビルドアップしたり、以下に表示される条件をコピーしたりできます。
    
    **\[searchValue\]**​ 項目値を ​`attributes.queryParams["internalId"]`​ に設定すると、コネクタはクエリパラメーターでこの値を使用するようになります。
    
    DataWeave コードは次のようになります。
    
    ```dataweave
    %dw 2.0
    output application/xml
    ns ns0  urn:messages_2020_2.platform.webservices.netsuite.com
    ns ns01 urn:common_2020_2.platform.webservices.netsuite.com
    ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
    ns xsi http://www.w3.org/2001/XMLSchema-instance
    ---
    {
    	ns0#search: {
    		ns0#searchRecord @("xmlns:ns01": ns01, xsi#"type": "ns01:AccountSearchBasic"): {
    			ns01#internalIdNumber @(operator: "lessThan"): {
    				ns02#searchValue: attributes.queryParams["internalId"]
    			}
    		}
    	}
    }
    ```

### [](#netsuite-connector-の-search-操作を追加する)NetSuite Connector の Search 操作を追加する

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[NetSuite\]**​ を選択して ​**\[Search\]**​ 操作を ​**\[Search Criteria\]**​ の右側にドラッグします。
2. **Search**​ 操作の表示名を ​`Search Account`​ に変更します。
3. 既存のグローバル要素を選択するか、​**Search**​ 操作用に新しい要素を作成します。
4. \[Search\] プロパティウィンドウで以下を行います。
    
    - ​**\[Key (キー)\]**​ 項目で ​`AccountSearchBasic`​ を選択します。
    - ​**\[Page Size (ページサイズ)\]**​ 項目値を ​`10`​ ～ ​`1000`​ の整数値に設定します。

### [](#for-each-コンポーネントを追加する)For Each コンポーネントを追加する

**\[Mule Palette (Mule パレット)\]**​ ビューから ​**\[Core (コア)\]**​ を選択して ​**\[For Each\]**​ コンポーネントを ​**\[Search Account\]**​ の右側にドラッグします。

### [](#2-つ目の-transform-message-コンポーネントを追加する)2 つ目の \[Transform Message\] コンポーネントを追加する

この ​**\[Transform Message\]**​ コンポーネントは、応答を JSON 形式に変換します。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[Transform Message\]**​ コンポーネントを ​**\[For Each\]**​ 内にドラッグします。
2. **\[Transform Message\]**​ コンポーネントの名前を ​`Response to JSON`​ に変更します。
3. 新しい ​**\[Transform Message\]**​ コンポーネントをクリックして、出力を ​`application/json`​ に設定します。
    
    ```dataweave
    %dw 2.0
    output application/json
    ns ns0 urn:core_2020_2.platform.webservices.netsuite.com
    ---
    payload.ns0#record
    ```
4. **\[Mule Palette (Mule パレット)\]**​ ビューの ​**\[Logger\]**​ コンポーネントをドラッグして ​**\[Response to JSON\]**​ の右側にドロップします。メッセージは ​`#[payload]`​ のままにします。

### [](#アプリケーションを実行する)アプリケーションを実行する

アプリケーションを実行する手順は、次のとおりです。

1. Mule アプリケーションを起動します。
2. `http://localhost:8081/account?internalId=5`​ をコールして、内部 ID が 5 未満の ​`Account`​ レコードを取得します。
3. 出力は、Mule アプリケーションコンソールからのみ確認できます。

### [](#アカウントの基本検索フローの-xml)アカウントの基本検索フローの XML

Studio で次のコードを新しい Mule アプリケーションに貼り付ければ、アカウントの基本検索の例のフローをすばやく読み込むことができます。必要に応じて、環境に合わせて値を変更します。

```xml
<?xml version="1.0" encoding="UTF-8"?>

<mule
    xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns:netsuite="http://www.mulesoft.org/schema/mule/netsuite" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/netsuite http://www.mulesoft.org/schema/mule/netsuite/current/mule-netsuite.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">


	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config">
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>
	<netsuite:config name="tokenConfig" doc:name="NetSuite SOAP Config">
		<netsuite:token-based-authentication-connection consumerKey="${netsuite.consumerKey}" consumerSecret="${netsuite.consumerSecret}" tokenId="${netsuite.tokenId}" tokenSecret="${netsuite.tokenSecret}" account="${netsuite.account}"/>
	</netsuite:config>
	<flow name="account-basic-search-flow">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="account">
			<http:response statusCode="200" />
		</http:listener>
		<ee:transform doc:name="Search Criteria">
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/xml
ns ns0  urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:common_2020_2.platform.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#search: {
		ns0#searchRecord @("xmlns:ns01": ns01, xsi#"type": "ns01:AccountSearchBasic"): {
			ns01#internalIdNumber @(operator: "lessThan"): {
				ns02#searchValue: attributes.queryParams["internalId"]
			}
		}
	}
}]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<netsuite:search doc:name="Search Account" config-ref="tokenConfig" key="AccountSearchBasic">
		</netsuite:search>
		<foreach doc:name="For Each">
			<ee:transform doc:name="Transform to JSON">
				<ee:message>
					<ee:set-payload><![CDATA[%dw 2.0
output application/json
ns ns0 urn:core_2020_2.platform.webservices.netsuite.com
---
payload.ns0#record
]]></ee:set-payload>
				</ee:message>
			</ee:transform>
			<logger level="INFO" doc:name="Logger" message="#[payload]"/>
		</foreach>
	</flow>
</mule>
```

## [](#employee-basic-search)Boolean (ブール値) 項目および String (文字列) 項目による従業員の基本検索の絞り込み

この例では、​`Search`​ 操作を使用して、姓の先頭が指定した文字である非アクティブな ​`Employee`​ レコードを取得する方法を示します。

この例では、NetSuite インスタンスの少なくとも 1 件の従業員レコードが検索条件を満たしている必要があります。

次のスクリーンショットは、従業員の基本検索の例の Studio アプリケーションフローを示しています。

![従業員の基本検索の例のアプリケーションフロー](/mulesoft/current/ja-jp/netsuite-connector/11.10/_images/netsuite-examples-search-employee.png)

Figure 2. Studio での従業員の基本検索アプリケーションフロー

この例を作成するには、新規 Mule プロジェクトを作成し、​`HTTP Listener`​、NetSuite Connector の ​`Search`​ 操作、1 つの ​`For Each`​ コンポーネント、2 つの ​`Transform Message`​ コンポーネントを設定する必要があります。

### [](#http-リスナーを設定する-2)HTTP リスナーを設定する

ローカルホストポート 8081 で ​`/employee`​ パスへのコールが行われたときに Mule フローを開始するように HTTP リスナーを設定します。

1. Studio で ​**\[HTTP\]**​ をクリックし、​**\[Listener\]**​ 操作をキャンバスにドラッグします。
2. **Listener**​ 操作の表示名を ​`/employee`​ に変更します。
3. 既存のグローバル要素を選択するか、​**HTTP Listener**​ 用に新しい要素を作成してデフォルトを保持します。
4. \[Listener\] プロパティウィンドウで、​**\[Path (パス)\]**​ 項目値を ​`/employee`​ に設定します。

### [](#最初の-transform-message-コンポーネントを追加する-2)最初の \[Transform Message\] コンポーネントを追加する

この ​**\[Transform Message\]**​ コンポーネントには、フローの検索条件が含まれています。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[Transform Message\]**​ コンポーネントを ​**\[Listener\]**​ の右側にドラッグします。
2. **\[Transform Message\]**​ コンポーネントの名前を ​`Search Criteria`​ に変更します。
3. **\[Transform Message\]**​ コンポーネントをクリックします。
    
    **\[Output (出力)\]**​ 列には ​**AccountSearchBasic**​ オブジェクトのメタデータが表示されます。そこから条件をビルドアップしたり、以下の条件をコピーしたりできます。
    
    値を ​`attributes.queryParams["isInactive"]`​ に設定すると、コネクタは非アクティブな従業員アカウントを検索するようになり、値を ​`attributes.queryParams["lastName"]`​ に設定すると、コネクタは姓の先頭が指定された値である従業員を検索するようになります。

DataWeave コードは次のようになります。

```dataweave
%dw 2.0
output application/xml
ns ns0  urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:common_2020_2.platform.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#search: {
		ns0#searchRecord @("xmlns:ns01": ns01, xsi#"type": "ns01:EmployeeSearchBasic"): {
			ns01#lastName @(operator: "startsWith"): {
				ns02#searchValue: attributes.queryParams["lastName"]
			},
			ns01#isInactive: {
				ns02#searchValue: attributes.queryParams["isInactive"]
			}
		}
	}
}
```

### [](#netsuite-connector-の-search-操作を追加する-2)NetSuite Connector の Search 操作を追加する

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[NetSuite\]**​ を選択して ​**\[Search\]**​ 操作を ​**\[Search Criteria\]**​ の右側にドラッグします。
2. **Search**​ 操作の表示名を ​`Search Employee`​ に変更します。
3. 既存のグローバル要素を選択するか、​**Search**​ 操作用に新しい要素を作成します。
4. \[Search\] プロパティウィンドウで以下を行います。
    
    - ​**\[Key (キー)\]**​ 項目で ​`EmployeeSearchBasic`​ を選択します。
    - ​**\[Page Size (ページサイズ)\]**​ 項目値を ​`10`​ ～ ​`1000`​ の整数値に設定します。

### [](#for-each-コンポーネントを追加する-2)For Each コンポーネントを追加する

**\[Mule Palette (Mule パレット)\]**​ ビューから ​**\[Core (コア)\]**​ を選択して ​**\[For Each\]**​ コンポーネントを ​**\[Search Employee\]**​ の右側にドラッグします。

### [](#2-つ目の-transform-message-コンポーネントを追加する-2)2 つ目の \[Transform Message\] コンポーネントを追加する

この ​**\[Transform Message\]**​ コンポーネントは、応答を JSON 形式に変換します。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[Transform Message\]**​ コンポーネントを ​**\[For Each\]**​ 内にドラッグします。
2. **\[Transform Message\]**​ コンポーネントの名前を ​`Response to JSON`​ に変更します。
3. 新しい ​**\[Transform Message\]**​ コンポーネントをクリックして、出力を ​`application/json`​ に設定します。
    
    ```dataweave
    %dw 2.0
    output application/json
    ns ns0 urn:core_2020_2.platform.webservices.netsuite.com
    ---
    payload.ns0#record
    ```
4. **\[Mule Palette (Mule パレット)\]**​ ビューの ​**\[Logger\]**​ コンポーネントをドラッグして ​**\[Response to JSON\]**​ の右側にドロップします。 メッセージは ​`#[payload]`​ になります。

### [](#アプリケーションを実行する-2)アプリケーションを実行する

1. Mule アプリケーションを起動します。
2. `http://localhost:8081/employee?isInactive=true&lastName=C`​ をコールして、姓の先頭が ​`C`​ である非アクティブな ​`Employee`​ レコードを取得します。
3. 出力は、Mule アプリケーションコンソールから​**のみ**​確認できます。

### [](#従業員の基本検索フローの-xml)従業員の基本検索フローの XML

Studio で次のコードを新しい Mule アプリケーションに貼り付ければ、従業員の基本検索の例のフローをすばやく読み込むことができます。必要に応じて、環境に合わせて値を変更します。

```xml
<?xml version="1.0" encoding="UTF-8"?>

<mule
    xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns:netsuite="http://www.mulesoft.org/schema/mule/netsuite" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/netsuite http://www.mulesoft.org/schema/mule/netsuite/current/mule-netsuite.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">


	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config">
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>
	<netsuite:config name="tokenConfig" doc:name="NetSuite SOAP Config">
		<netsuite:token-based-authentication-connection consumerKey="${netsuite.consumerKey}" consumerSecret="${netsuite.consumerSecret}" tokenId="${netsuite.tokenId}" tokenSecret="${netsuite.tokenSecret}" account="${netsuite.account}"/>
	</netsuite:config>

    <flow name="employee-basic-search-flow">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="employee"/>
		<ee:transform doc:name="Search Criteria">
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/xml
ns ns0  urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:common_2020_2.platform.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#search: {
		ns0#searchRecord @("xmlns:ns01": ns01, xsi#"type": "ns01:EmployeeSearchBasic"): {
			ns01#lastName @(operator: "startsWith"): {
				ns02#searchValue: attributes.queryParams["lastName"]
			},
			ns01#isInactive: {
				ns02#searchValue: attributes.queryParams["isInactive"]
			}
		}
	}
}
]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<netsuite:search doc:name="Search Employee" config-ref="tokenConfig" key="EmployeeSearchBasic"/>
		<foreach doc:name="For Each">
			<ee:transform doc:name="Transform to JSON">
				<ee:message >
					<ee:set-payload ><![CDATA[%dw 2.0
output application/json
ns ns0 urn:core_2020_2.platform.webservices.netsuite.com
---
payload.ns0#record
]]></ee:set-payload>
				</ee:message>
			</ee:transform>
			<logger level="INFO" doc:name="Logger" message="#[payload]" />
		</foreach>
	</flow>
</mule>
```

## [](#customer-advanced-search)\[Stage (フェーズ)\] 項目および \[Date Created (作成日付)\] 項目による顧客の詳細検索の絞り込み

この例では、​`Search`​ 操作を使用して、2015 年以降に作成されて ​`LEAD`​ フェーズにある顧客レコードを取得する方法を示します。

この例では、少なくとも 1 件の顧客レコードが NetSuite インスタンスの検索条件を満たしている必要があります。

次のスクリーンショットは、この例の Studio アプリケーションフローを示しています。

![顧客の詳細検索の例のアプリケーションフロー](/mulesoft/current/ja-jp/netsuite-connector/11.10/_images/netsuite-examples-search-customer.png)

Figure 3. Studio での顧客の詳細検索アプリケーションフロー

この例を作成するには、新規 Mule プロジェクトを作成し、​`HTTP リスナー`​、NetSuite ​`Search`​ 操作、2 つの ​`Transform Message`​ コンポーネント、および ​`For-Each`​ コンポーネントを設定する必要があります。

### [](#http-リスナーを設定する-3)HTTP リスナーを設定する

ローカルホストポート 8081 で ​`/customer`​ パスへのコールが行われたときに Mule フローを開始するように HTTP リスナーを設定します。

1. Studio で ​**\[HTTP\]**​ をクリックし、​**\[Listener\]**​ 操作をキャンバスにドラッグします。
2. **Listener**​ 操作の表示名を ​`/customer`​ に変更します。
3. 既存のグローバル要素を選択するか、​**Listener**​ 操作用に新しい要素を作成します。
4. \[Listener\] プロパティウィンドウで、​**\[path (パス)\]**​ 項目値を ​`/customer`​ に設定します。

### [](#最初の-transform-message-コンポーネントを追加する-3)最初の \[Transform Message\] コンポーネントを追加する

この ​**\[Transform Message\]**​ コンポーネントでは、フローの検索条件を指定します。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[Transform Message\]**​ コンポーネントを ​**\[Listener\]**​ の右側にドラッグします。
2. **\[Transform Message\]**​ コンポーネントの名前を ​`Search Criteria`​ に変更します。
3. **\[Transform Message\]**​ コンポーネントをクリックします。
    
    **\[Output (出力)\]**​ 列には ​**CustomerSearchAdvanced**​ オブジェクトのメタデータが表示されます。そこから条件をビルドアップしたり、以下の条件をコピーしたりできます。
    
    `stage`​ の ​**searchValue**​ を ​`attributes.queryParams["stage"]`​ に設定すると、コネクタは ​`stage`​ クエリパラメーターの値を使用するようになります。

DataWeave コードは次のようになります。

```dataweave
%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:common_2020_2.platform.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns ns03 urn:relationships_2020_2.lists.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#search: {
		ns0#searchRecord @("xmlns:ns03": ns03, xsi#"type": "ns03:CustomerSearchAdvanced"): {
			ns03#criteria: {
				ns03#basic: {
					ns01#stage @(operator: "anyOf"): {
						ns02#searchValue: [attributes.queryParams["stage"]]
					},
					ns01#dateCreated @(operator: "after"): {
						ns02#searchValue: "2015-01-01T00:00:00.000-08:00"
					}
				}
			}
		}
	}
}
```

### [](#netsuite-connector-の-search-操作を追加する-3)NetSuite Connector の Search 操作を追加する

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[NetSuite\]**​ を選択して ​**\[Search\]**​ 操作を ​**\[Search Criteria\]**​ の右側にドラッグします。
2. **Search**​ 操作の表示名を ​`Search Customer Advanced`​ に変更します。
3. 既存のグローバル要素を選択するか、​**Search**​ 操作用に新しい要素を作成します。
4. \[Search\] プロパティウィンドウで以下を行います。
    
    - **\[Key (キー)\]**​ 項目で ​`CustomerSearchAdvanced`​ を選択します。
    - **\[Page Size (ページサイズ)\]**​ 項目値を ​`10`​ ～ ​`1000`​ の整数値に設定します。
    - **\[Search Preferences (検索設定)\]**​ をクリックして、​`[Return search columns (検索列を返す)]`​ で ​`false`​ を選択します。

### [](#for-each-コンポーネントを追加する-3)For-Each コンポーネントを追加する

`For-Each`​ コンポーネントは、レコードをコンソールに表示できるように、​`Search`​ 操作によって個別に返されるリストの各レコードを処理します。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**For-Each**​ コンポーネントを ​**\[Search\]**​ の右側にドラッグします。
2. **\[Transform Message\]**​ コンポーネントを ​**\[For Each\]**​ ボックス内にドラッグして、コンポーネントの名前を ​`Response to JSON`​ に変更し、DataWeave コードを次のコードに置き換えます。
    
    ```dataweave
    %dw 2.0
    output application/json
    ns ns0 urn:core_2020_2.platform.webservices.netsuite.com
    ---
    payload.ns0#record
    ```
3. **\[Logger\]**​ コンポーネントを ​**\[Mule Palette (Mule パレット)\]**​ ビューから ​**\[For Each\]**​ ボックス内の ​**\[Transform\]**​ の右側にドラッグします。
4. \[Logger\] プロパティウィンドウで、​**\[Message (メッセージ)\]**​ 項目値を ​`#[payload]`​ に設定します。

### [](#アプリケーションを実行する-3)アプリケーションを実行する

1. Mule アプリケーションを起動します。
2. `http://localhost:8081/customer?stage=LEAD`​ をコールします。
3. 出力は、Mule アプリケーションコンソールから​**のみ**​確認できます。

### [](#顧客の詳細検索フローの-xml)顧客の詳細検索フローの XML

Studio で次のコードを新しい Mule アプリケーションに貼り付ければ、顧客の詳細検索の例のフローをすばやく読み込むことができます。必要に応じて、環境に合わせて値を変更します。

```xml
<?xml version="1.0" encoding="UTF-8"?>

<mule
    xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns:netsuite="http://www.mulesoft.org/schema/mule/netsuite" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/netsuite http://www.mulesoft.org/schema/mule/netsuite/current/mule-netsuite.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">


	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config">
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>
	<netsuite:config name="tokenConfig" doc:name="NetSuite SOAP Config">
		<netsuite:token-based-authentication-connection consumerKey="${netsuite.consumerKey}" consumerSecret="${netsuite.consumerSecret}" tokenId="${netsuite.tokenId}" tokenSecret="${netsuite.tokenSecret}" account="${netsuite.account}"/>
	</netsuite:config>

    <flow name="customer-advanced-search-flow">
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="customer" />
		<ee:transform doc:name="Search Criteria">
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:common_2020_2.platform.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns ns03 urn:relationships_2020_2.lists.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#search: {
		ns0#searchRecord @("xmlns:ns03": ns03, xsi#"type": "ns03:CustomerSearchAdvanced"): {
			ns03#criteria: {
				ns03#basic: {
					ns01#stage @(operator: "anyOf"): {
						ns02#searchValue: [attributes.queryParams["stage"]]
					},
					ns01#dateCreated @(operator: "after"): {
						ns02#searchValue: "2015-01-01T00:00:00.000-08:00"
					}
				}
			}
		}
	}
}]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<netsuite:search doc:name="Search Customer Advanced" config-ref="tokenConfig" returnSearchColumns="false" key="CustomerSearchAdvanced"/>
		<foreach doc:name="For Each">
			<ee:transform doc:name="Transform to JSON">
			<ee:message>
				<ee:set-payload><![CDATA[%dw 2.0
output application/json
ns ns0 urn:core_2020_2.platform.webservices.netsuite.com
---
payload.ns0#record
]]></ee:set-payload>
			</ee:message>
		</ee:transform>
			<logger level="INFO" doc:name="Logger" message="#[payload]" />
		</foreach>
	</flow>
</mule>
```

## [](#add-file)ファイルの追加

次の例は、NetSuite Connector の ​**Add**​ 操作を使用してファイルを追加する方法を示しています。

次のスクリーンショットは、この例の Studio アプリケーションフローを示しています。

![ファイルの追加の例のアプリケーションフロー](/mulesoft/current/ja-jp/netsuite-connector/11.10/_images/add-file.png)

この例を作成するには、新しい Mule プロジェクトを作成し、​**Listener**​ コンポーネント、​**Transform Message**​ コンポーネント、​**Add**​ 操作、​**Logger**​ コンポーネントを設定する必要があります。

### [](#http-リスナーを設定する-4)HTTP リスナーを設定する

`/upload`​ パスへのコールが行われたときに Mule フローを開始するように HTTP Listener を設定します。

1. Studio で新しい Mule プロジェクトを作成します。
2. Studio で ​**\[HTTP\]**​ をクリックし、​**\[Listener\]**​ コンポーネントをキャンバスにドラッグします。
3. **\[Listener\]**​ プロパティウィンドウで、​**\[Connector configuration (コネクタ設定)\]**​ 項目の横にある ​**\[+\]**​ をクリックしてグローバル要素を追加します。
4. デフォルトを受け入れます。
5. **\[Listener\]**​ プロパティウィンドウで、​**\[Path (パス)\]**​ 項目値を ​`/upload`​ に設定します。

### [](#transform-message-コンポーネントを追加する)\[Transform Message\] コンポーネントを追加する

HTTP 入力の値を XML 形式に変換して ​**Add**​ 操作の入力として使用できるようにする ​**Transform Message**​ コンポーネントを追加します。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[Core (コア)\]**​ を選択して ​**\[Transform Message\]**​ コンポーネントを ​**\[Listener\]**​ の右側にドラッグします。
2. プロパティウィンドウで、​**\[Output (出力)\]**​ セクションの括弧を次の DataWeave コードで上書きします。
    
    ```dataweave
    %dw 2.0
    output application/xml
    ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
    ns ns01 urn:filecabinet_2020_2.documents.webservices.netsuite.com
    ns xsi http://www.w3.org/2001/XMLSchema-instance
    ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
    ---
    {
    	ns0#add: {
    		ns0#record @("xmlns:ns01": ns01, xsi#"type": "ns01:File"): {
    			ns01#name: "test.csv",
    			ns01#content: "Here is the content of file",
    			ns01#folder @(internalId: 826997 , xsi#"type": "ns01:RecordRef"): {
    				ns02#name: null
    			}
    		}
    	}
    }
    ```

### [](#add-操作を追加する)Add 操作を追加する

**Transform Message**​ コンポーネントにより渡された値を使用してファイルを追加する ​**Add**​ 操作を追加します。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[NetSuite\]**​ を選択して ​**\[Add\]**​ 操作を ​**\[Transform Message\]**​ の右側にドラッグします。
2. プロパティウィンドウで、​**\[Connector configuration (コネクタ設定)\]**​ 項目の横にある ​**\[+\]**​ をクリックしてグローバル要素を追加します。
3. 接続に応じてグローバル要素を設定します。次に例を示します。
    
    <table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">項目</th>
<th class="tableblock halign-left valign-top">値</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Consumer key (コンシューマーキー)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>${netsuite.consumerKey}</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Consumer secret (コンシューマーシークレット)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>${netsuite.consumerSecret}</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Token ID (トークン ID)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>${netsuite.tokenId}</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Token secret (トークンシークレット)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>${netsuite.tokenSecret}</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Account Id (取引先 ID)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>${netsuite.account}</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Signature algorithm (署名アルゴリズム)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>HMAC_SHA256</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Wsdl version (Wsdl バージョン)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>V2020_2</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">SOAP Port (SOAP ポート)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>services/NetSuitePort_2020_2</code></p></td>
</tr>
</tbody>
</table>
    
    次の画像は、グローバル要素の ​**Add**​ 設定の例を示しています。
    
    ![Add 操作のグローバル要素設定ウィンドウ](/mulesoft/current/ja-jp/netsuite-connector/11.10/_images/add-config-window.png)
4. プロパティウィンドウで、次の項目を設定します。
    
    <table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">項目</th>
<th class="tableblock halign-left valign-top">値</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Display Name (表示名)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">コネクタ操作の名前。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Connector configuration (コネクタ設定)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">作成したばかりのグローバル設定。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Type (型)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>file</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Message (メッセージ)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>vars.fileRecord</code></p></td>
</tr>
</tbody>
</table>
    
    次の画像は、プロパティウィンドウでの ​**Add**​ 設定の例を示しています。
    
    ![Add 操作のプロパティウィンドウ設定](/mulesoft/current/ja-jp/netsuite-connector/11.10/_images/add-properties-window.png)

### [](#logger-コンポーネントを追加する)Logger コンポーネントを追加する

Mule コンソールに応答を表示する ​**Logger**​ コンポーネントを追加します。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[Core (コア)\]**​ を選択して ​**\[Logger\]**​ コンポーネントを ​**\[Add\]**​ の右側にドラッグします。
2. プロパティウィンドウで、次の項目を設定します。
    
    <table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">項目</th>
<th class="tableblock halign-left valign-top">値</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Display Name (表示名)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ロガーの名前 (​<code>Logger</code>​ など)。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Message (メッセージ)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>The file was added (ファイルが追加されました)</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Level (レベル)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">INFO (デフォルト)</p></td>
</tr>
</tbody>
</table>
    
    次の図は、プロパティウィンドウでの ​**\[Logger\]**​ 設定の例を示しています。
    
    ![\[Logger\] プロパティウィンドウ設定](_images/add-file-logger.png)

### [](#アプリケーションを実行する-4)アプリケーションを実行する

アプリケーションを実行する手順は、次のとおりです。

1. Mule アプリケーションを起動します。
2. `http://localhost:8081/upload`​ をコールして、ファイルを追加します。

### [](#ファイルの追加のフローの-xml)ファイルの追加のフローの XML

ファイルの追加の例のフローをすばやく読み込むには、Studio で次のコードを新しい Mule アプリケーションに貼り付けます。必要に応じて、環境に合わせて値を変更します。

```xml
<?xml version="1.0" encoding="UTF-8"?>
​
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
	xmlns:file="http://www.mulesoft.org/schema/mule/file"
	xmlns:netsuite="http://www.mulesoft.org/schema/mule/netsuite"
	xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns="http://www.mulesoft.org/schema/mule/core"
	xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/netsuite http://www.mulesoft.org/schema/mule/netsuite/current/mule-netsuite.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
​

	  <netsuite:config name="NetSuite_Config1" doc:name="NetSuite Config"
		doc:id="510151ba-ce6a-4401-8901-4269280d09d1" > <netsuite:token-based-authentication-connection
		consumerKey="${netsuite.consumerKey}" consumerSecret="${netsuite.consumerSecret}"
		tokenId="${netsuite.tokenId}" tokenSecret="${netsuite.tokenSecret}" account="${netsuite.account}"
		soapPort="services/NetSuitePort_2020_2" wsdlVersion="V2020_2"> </netsuite:token-based-authentication-connection> </netsuite:config>
​
​
	<configuration-properties
		doc:name="Configuration properties"
		doc:id="b2a18b7c-9a82-41d3-828e-7bdd488ddf13" file="config.yaml" />

	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="f5d39893-7a0e-42fb-9272-953b705adafa" >
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>

	<flow name="test-netsuite-appFlow"
		doc:id="07490264-2157-4937-922b-d58199505338">


		<http:listener doc:name="Listener" doc:id="4fbbf511-2f66-44a3-bcf5-05094e2b92e7" config-ref="HTTP_Listener_config" path="/upload"/>
		<ee:transform doc:name="fileRecord" doc:id="50c11321-c8a9-47ba-a06e-7a26b0aefcfb" >
            <ee:message >
            </ee:message>
            <ee:variables >
                <ee:set-variable variableName="fileRecord" ><![CDATA[%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:filecabinet_2020_2.documents.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
---
{
	ns0#add: {
		ns0#record @("xmlns:ns01": ns01, xsi#"type": "ns01:File"): {
			ns01#name: "test.csv",
			ns01#content: "Here is the content of file",
			ns01#folder @(internalId: 826997 , xsi#"type": "ns01:RecordRef"): {
				ns02#name: null
			}
		}
	}
}]]></ee:set-variable>
            </ee:variables>
        </ee:transform>
		<netsuite:add doc:name="Add" doc:id="ddc65bfd-73b5-4a8f-9bd7-bafe4e479db7" config-ref="NetSuite_Config1" type="file">
				<netsuite:message ><![CDATA[#[vars.fileRecord]]]></netsuite:message>
		</netsuite:add>
		<logger level="INFO" doc:name="Logger"
			doc:id="1f48613a-8a9e-4baa-8787-c4531a8e620e" message="The file was added"/>
	</flow>
</mule>
```

## [](#カスタムレコードおよび項目)カスタムレコードおよび項目

次の例は、DataWeave を使用してカスタム項目を含むカスタムレコードを追加、取得、および削除する方法を示しています。NetSuite Connector からメタデータをインポートする DataSense を使用して、アプリケーション設計を簡素化します。

次のスクリーンショットは、この例の Studio アプリケーションフローを示しています。

![カスタムレコードの例のアプリケーションフロー](/mulesoft/current/ja-jp/netsuite-connector/11.10/_images/custom-record-flow.png)

この例を作成するには、​**Add**​ 操作、​**Set Variable**​ コンポーネント、​**Get**​ 操作、および ​**Delete**​ 操作を追加する必要があります。

### [](#add-custom-record)カスタムレコードの追加

**Add**​ 操作を使用して、カスタム項目を含むカスタムレコードを追加します。

カスタムレコードを追加するには、次の属性を含めます。

- **separators**
    
    区切り文字を指定します。次の例の区切り文字は ​`__`​ です。
- **recordType**
    
    カスタムレコードタイプを参照します。次の例の recordType は ​`customRecordType`​ です。
- **scriptId**
    
    レコードのスクリプト ID を参照します。次の例の scriptId は ​`customrecord_2663_bank_details`​ です。
- **internalId**
    
    レコードの内部 ID を参照します。次の例の internalId は ​`374`​ です。
- **XSI 型**
    
    カスタムレコードを追加するには、XSI 型を ​**CustomRecordRef**​ として指定します。

次の DataWeave スクリプトでは、カスタム項目を含むカスタムレコードを追加します。

%dw 2.0
output application/xml
ns ns0 urn:messages\_2020\_2.platform.webservices.netsuite.com
ns ns01 urn:customization\_2020\_2.setup.webservices.netsuite.com
ns ns02 urn:core\_2020\_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#add: {
		ns0#record @("xmlns:ns01": ns01, xsi#"type": "ns01:CustomRecord"): {
			ns01#customFieldList: {
				StringCustomFieldRef\_\_custrecord\_2663\_legal\_name\_\_3878: {
					ns02#value: "test"
				},
				LongCustomFieldRef\_\_custrecord\_2663\_eft\_file\_cabinet\_id\_\_3874: {
					ns02#value: 1234
				},
				BooleanCustomFieldRef\_\_custrecord\_2663\_dd\_batch\_\_3864: {
					ns02#value: true
				}
			}
		}
	}
}

customFieldList には、使用するエンティティの customFields が含まれます。

上記の例では、​ `StringCustomFieldRef__custrecord_2663_legal_name__3878` 、 `BooleanCustomFieldRef__custrecord_2663_dd_batch__3864` および `LongCustomFieldRef__custrecord_2663_eft_file_cabinet_id__3874`​ が示されています。項目の名前は、​ **scriptId**​ 、​ **internalId**​ 、​ **CustomRecordRef**​ 種別で構成されます。

`StringCustomFieldRef__custrecord_2663_legal_name__3878`​ には指定された値 `​ns02#value: "test"​` があり、`LongCustomFieldRef__custrecord_2663_eft_file_cabinet_id__3874` には指定された値 `​ns02#value: 1234​` があり、`BooleanCustomFieldRef__custrecord_2663_dd_batch__3864`​ には ​`ns02#value: true`​ があります。

### [](#get-custom-record)Get Custom Record

**Get**​ 操作を使用して、カスタム項目を含むカスタムレコードを取得します。

カスタムレコードを取得するには、次の属性を含めます。

- **typeId**
    
    カスタムレコードタイプ ID を参照します。次の例の typeId は ​`374`​ です。
- **internalId**
    
    レコードの internalId を参照します。次の例の internalId は ​`vars.responseInternalId`​ です。
- **XSI 型**
    
    カスタムレコードを取得するには、XSI 型を ​**CustomRecordRef**​ として指定します。

次の DataWeave スクリプトでは、カスタム項目を含むカスタムレコードを取得します。

%dw 2.0
output application/xml
ns ns0 urn:messages\_2020\_2.platform.webservices.netsuite.com
ns ns01 urn:core\_2020\_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#get: {
		ns01#baseRef @(internalId: vars.responseInternalId , "typeId": "374", xsi#"type": "ns01:CustomRecordRef"): null
	}
}

### [](#delete-custom-record)カスタムレコードの削除

**Delete**​ 操作を使用して、カスタム項目を含むカスタムレコードを削除します。

カスタムレコードを削除するには、次の属性を含めます。

- **typeId**
    
    カスタムレコードタイプ ID を参照します。次の例の typeId は ​`374`​ です。
- **internalId**
    
    レコードの internalId を参照します。次の例の internalId は ​`vars.responseInternalId`​ です。
- **XSI 型**
    
    カスタムレコードを削除するには、XSI 型を ​**CustomRecordRef**​ として指定します。

次の DataWeave スクリプトでは、カスタム項目を含むカスタムレコードを削除します。

%dw 2.0
output application/xml
ns ns0 urn:messages\_2020\_2.platform.webservices.netsuite.com
ns ns01 urn:core\_2020\_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#delete: {
		ns01#baseRef @(internalId: vars.responseInternalId , "typeId": "374", xsi#"type": "ns01:CustomRecordRef"): null
	}
}

### [](#カスタムレコードの-xml)カスタムレコードの XML

カスタムレコードの例のフローをすばやく読み込むには、Studio で次のコードを新しい Mule アプリケーションに貼り付けます。必要に応じて、環境に合わせて値を変更します。

```xml
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:netsuite="http://www.mulesoft.org/schema/mule/netsuite"
	xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://www.mulesoft.org/schema/mule/core"
	xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xsi:schemaLocation="
		http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/netsuite http://www.mulesoft.org/schema/mule/netsuite/current/mule-netsuite.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
	<flow name="recordWithCustomFields">
		<netsuite:add doc:name="Add"
			doc:id="e8643704-bba5-4156-83b7-73650b2661ac"
			config-ref="tokenConfig" type="__customRecordType__customrecord_2663_bank_details__374">
			<netsuite:message><![CDATA[#[%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:customization_2020_2.setup.webservices.netsuite.com
ns ns02 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#add: {
		ns0#record @("xmlns:ns01": ns01, xsi#"type": "ns01:CustomRecord"): {
			ns01#customFieldList: {
				StringCustomFieldRef__custrecord_2663_legal_name__3878: {
					ns02#value: "test"
				},
				LongCustomFieldRef__custrecord_2663_eft_file_cabinet_id__3874: {
					ns02#value: 1234
				},
				BooleanCustomFieldRef__custrecord_2663_dd_batch__3864: {
					ns02#value: true
				}
			}
		}
	}
}]]]></netsuite:message>
		</netsuite:add>
		<set-variable
			value="#[%dw 2.0&#10;output application/java&#10;ns ns0 http://schemas.xmlsoap.org/soap/envelope/&#10;ns ns01 urn:messages_2020_2.platform.webservices.netsuite.com&#10;---&#10;payload.ns01#addResponse.ns01#writeResponse.ns01#baseRef.@internalId]"
			doc:name="Set Variable" doc:id="0fc988de-84a2-45f1-a991-e01328d38d7f"
			variableName="responseInternalId" />
		<netsuite:get doc:name="Get record"
			doc:id="b4904b67-0fd9-468e-a649-b8d6bd54e2c4"
			config-ref="tokenConfig" refType="CustomRecordRef" type="__customRecordType__customrecord_2663_bank_details__374">
			<netsuite:message><![CDATA[#[%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#get: {
		ns01#baseRef @(internalId: vars.responseInternalId , "typeId": "374", xsi#"type": "ns01:CustomRecordRef"): null
	}
}]]]></netsuite:message>
		</netsuite:get>
		<netsuite:delete doc:name="Delete record"
			doc:id="fd4d9343-759b-4c08-a74d-a66f04c5c513"
			config-ref="tokenConfig" type="__customRecordType__customrecord_2663_bank_details__374" refType="CustomRecordRef">
			<netsuite:message><![CDATA[#[%dw 2.0
output application/xml
ns ns0 urn:messages_2020_2.platform.webservices.netsuite.com
ns ns01 urn:core_2020_2.platform.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
	ns0#delete: {
		ns01#baseRef @(internalId: vars.responseInternalId , "typeId": "374", xsi#"type": "ns01:CustomRecordRef"): null
	}
}]]]></netsuite:message>
		</netsuite:delete>
	</flow>
</mule>
```

## [](#関連情報)関連情報

- [Anypoint Connector の概要](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [MuleSoft ヘルプセンター](https://help.mulesoft.com)