---
schema_version: "1"
id: 072ad0e3445c3a8ad82c1b960d7a6cd306b3ccd8c80aa7416a290da6997660e4
title: Studio を使用した NetSuite Connector の設定
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/netsuite-connector/9.3/netsuite-studio-configure.md
canonical_url: https://docs.mulesoft.com/jp/netsuite-connector/9.3/netsuite-studio-configure
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 973d4da1fc66d99aed8fdb2da8f5ff6a856bbeeb5f1041313ceb89d1f3e8fac5
description: MuleSoft Documentation Site
release: "9.3"
latest: false
---
# Studio を使用した NetSuite Connector の設定

## [](#studio-プロジェクトへのコネクタの追加)Studio プロジェクトへのコネクタの追加

Anypoint Studio には、Studio プロジェクトにコネクタを追加する 2 つの方法があります。Studio タスクバーの Exchange ボタンから追加するか、\[Mule Palette (Mule パレット)\] ビューから追加します。

### [](#exchange-を使用してコネクタを追加する)Exchange を使用してコネクタを追加する

1. Studio で Mule プロジェクトを作成します。
2. Studio タスクバーの左上にある Exchange アイコン **(X)**​ をクリックします。
3. Exchange で、**\[Login (ログイン)\]**​ をクリックし、Anypoint Platform のユーザー名とパスワードを指定します。
4. Exchange で、「netsuite」を検索します。
5. コネクタを選択して **\[Add to project (プロジェクトに追加)\]**​ をクリックします。
6. 画面の指示に従ってコネクタをインストールします。

### [](#studio-でコネクタに追加する)Studio でコネクタに追加する

1. Studio で Mule プロジェクトを作成します。
2. \[Mule Palette (Mule パレット)\] ビューで、**\[(X) Search in Exchange ((X) Exchange 内を検索)\]**​ をクリックします。
3. **\[Add Modules to Project (モジュールをプロジェクトに追加)\]**​ で、検索項目に「netsuite」と入力します。
4. **\[Available modules (使用可能なモジュール)\]**​ で、このコネクタの名前をクリックします。
5. **\[Add (追加)\]**​ をクリックします。
6. **\[Finish (完了)\]**​ をクリックします。

### [](#studio-で設定する)Studio で設定する

1. コネクタの操作を Studio キャンバスにドラッグします。
2. グローバルコネクタ設定にリストされている認証メカニズムを選択します。次のいずれかを選択できます。
    
    <table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 30%;">
<col style="width: 70%;">
</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"><strong>Login Authentication (ログイン認証)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>コネクタが送信する最初の要求で SuiteTalk のログイン API コールを使用して NetSuite とのセッションを確立します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Request Based Authentication (要求ベース認証)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>この戦略を使用すると、ログインを呼び出して NetSuite に対して認証する代わりに、各要求の SOAP ヘッダーでユーザーのログイン情報を送信できます。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Single Sign-On Authentication (シングルサインオン認証)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>これは、環境ユーザー名とパスワードを使用しないトークンベースの認証システムです。この場合は、privateKey とその他の情報を指定します。コネクタは、認証トークンを生成し、最初の要求で <code>ssoLogin</code>​ API コールを使用して NetSuite とのセッションを確立します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Token Authentication (トークン認証)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>シングルサインオンログイン認証に類似するトークンベースの認証システムです。ただし、openssl を使用して生成された privateKey を使用する代わりに、コンシューマーおよびトークンのキー/シークレットの組み合わせを使用します。これらは NetSuite 環境内で確立されます。</p>
</div></div></td>
</tr>
</tbody>
</table>
3. 選択に応じて、次の項目を設定します。
    
    1. Login Authentication (ログイン認証)
        
        ![login authentication (ログイン認証)](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-login-studio.png)
        
        <table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 30%;">
<col style="width: 70%;">
</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"><strong>Name (名前)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>後ほど参照するために設定の名前を入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>メール</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>NetSuite UI のログインメールを入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Password (パスワード)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>NetSuite UI にログインするためのパスワードを入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>アカウント。</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>SuiteTalk NetSuite Web サービスのアカウント ID を入力します。通常これは、NetSuite Sandbox UI 内の [Setup (設定)] &gt; [Integration (インテグレーション)] &gt; [Web Service Preferences (Web サービスプリファレンス)] にあります。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Role Id (ロール ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>SuiteTalk でのユーザーのロール ID を入力します。これによってプロセッサー権限が決まります。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Application Id (アプリケーション ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>使用するインテグレーションレコードに対応するアプリケーション ID を入力します。</p>
</div></div></td>
</tr>
</tbody>
</table>
    2. Request Based Authentication (要求ベース認証)
        
        ![request based authentication (要求ベース認証)](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-request-studio.png)
        
        <table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 30%;">
<col style="width: 70%;">
</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"><strong>Name (名前)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>後ほど参照するために設定の名前を入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>メール</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>NetSuite UI のログインメールを入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Password (パスワード)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>NetSuite UI にログインするためのパスワードを入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>アカウント。</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>SuiteTalk NetSuite Web サービスのアカウント ID を入力します。通常これは、NetSuite Sandbox UI 内の [Setup (設定)] &gt; [Integration (インテグレーション)] &gt; [Web Service Preferences (Web サービスプリファレンス)] にあります。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Role Id (ロール ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>SuiteTalk でのユーザーのロール ID を入力します。これによってプロセッサー権限が決まります。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Application Id (アプリケーション ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>使用するインテグレーションレコードに対応するアプリケーション ID を入力します。</p>
</div></div></td>
</tr>
</tbody>
</table>
    3. SSO Authentication (SSO 認証)
        
        ![request based authentication (要求ベース認証)](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-sso-studio.png)
        
        <table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 30%;">
<col style="width: 70%;">
</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"><strong>Name (名前)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>後ほど参照できるように設定の名前を入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>SSO Library (SSO ライブラリ)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>[Add Dependency (連動関係を追加)] をクリックし、SSO 連動関係を Maven 連動関係形式で追加します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Partner Id (パートナー ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>マッピングプロセスで使用されるパートナー ID を入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Partner Account (パートナーアカウント)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>SuiteTalk NetSuite Web サービスのアカウント ID を入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Company ID (会社 ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>マッピングプロセスでコネクタがトークンを生成するために使用する会社 ID を入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>User ID (ユーザー ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>マッピングプロセスでコネクタがトークンを生成するために使用するユーザー ID を入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Key File (キーファイル)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>プロジェクトから選択する privateKey ファイル名を入力します。このファイルは、NetSuite の仕様に従って生成された .der ファイルである必要があります。これは、会社 ID とユーザー ID を暗号化して ssoLogin 用のトークンにするために使用されます。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Application Id (アプリケーション ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>使用するインテグレーションレコードに対応するアプリケーション ID を入力します。</p>
</div></div></td>
</tr>
</tbody>
</table>
    4. Token Authentication (トークン認証)
        
        ![request based authentication (要求ベース認証)](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-token-studio.png)
        
        <table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 30%;">
<col style="width: 70%;">
</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"><strong>Consumer Key (コンシューマーキー)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>使用するトークンベース認証対応のインテグレーションレコードのコンシューマーキーを入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Consumer Secret (コンシューマーシークレット)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>使用するトークンベース認証対応のインテグレーションレコードのコンシューマーシークレットを入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Token ID (トークン ID)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>NetSuite 環境内で生成されたユーザーとインテグレーションの一意の組み合わせを表すトークン ID を入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Token Secret (トークンシークレット)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>ユーザー/インテグレーションの各組み合わせに対するトークンシークレットを入力します。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>アカウント。</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>SuiteTalk NetSuite Web サービスのアカウント ID を入力します。通常これは、NetSuite Sandbox UI 内の [Set Up (セットアップ)] &gt; [Integration (インテグレーション)] &gt; [Web Service Preferences (Web サービスプリファレンス)] にあります。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Signature algorithm (署名アルゴリズム)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>HMAC 署名アルゴリズムの種別</p>
</div></div></td>
</tr>
</tbody>
</table>

## [](#ユースケース-netsuite-restlet-のコール)ユースケース: NetSuite RESTlet のコール

このユースケースは、NetSuite インスタンスにデプロイされた RESTlet をコールする方法を示しています。

これらの手順に従うことで、次のことを実行できます。

- 顧客レコードを作成する。
- 顧客レコードを取得する。
- レコードを削除します。

### [](#前提条件)前提条件

- Java 8
- Anypoint Studio 7.0.x
- Mule Runtime 4.0.x EE
- DataWeave 2.0
- NetSuite インスタンスへのアクセス権と `mule-app.properties`​ ファイル内のログイン情報

### [](#restlet-としてのスクリプトのデプロイ)RESTlet としてのスクリプトのデプロイ

1. サンプル JavaScript スクリプトを作成します。
    
    ```javascript
    // Get a standard NetSuite record
    function getRecord(datain)
    {
        return nlapiLoadRecord(datain.recordtype, datain.id);
        // for example, recordtype="customer", id="769"
    }
    
    // Create a standard NetSuite record
    
    function createRecord(datain)
    {
        var err = new Object();
    
        // Validate if mandatory record type is set in the request
        if (!datain.recordtype)
        {
            err.status = "failed";
            err.message= "missing recordtype";
            return err;
        }
    
        var record = nlapiCreateRecord(datain.recordtype);
    
        for (var fieldname in datain)
        {
          if (datain.hasOwnProperty(fieldname))
          {
            if (fieldname != 'recordtype' && fieldname != 'id')
            {
              var value = datain[fieldname];
                if (value && typeof value != 'object')
                // ignore other type of parameters
                {
                  record.setFieldValue(fieldname, value);
                }
            }
          }
        }
        var recordId = nlapiSubmitRecord(record);
        nlapiLogExecution('DEBUG','id='+recordId);
        var nlobj = nlapiLoadRecord(datain.recordtype,recordId);
        return nlobj;
    }
    
    // Delete a standard NetSuite record
    function deleteRecord(datain)
    {
      nlapiDeleteRecord(datain.recordtype, datain.id);
      // for example: recordtype="customer", id="769"
    
    }
    ```
2. アカウントの SuiteScript と Web サービスを有効にします。NetSuite にログインし、\[Set Up (セットアップ)\] > \[Company (会社)\] > \[Enable Features (機能の有効化)\] > \[SuiteCloud\] をクリックします。
    
    ![SuiteScript の有効化](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-enable-suitescript.png)
3. 新しいスクリプトを作成し、以前に作成したファイルをアップロードします。\[Customization (カスタマイズ)\] > \[Scripting (スクリプト)\] > \[Scripts (スクリプト)\] > \[New (新規)\] に移動します。
4. スクリプトファイルを選択し、\[Create Script Record (スクリプトレコードの作成)\] をクリックし、\[RESTlet\] を選択します。
    
    ![スクリプト種別の選択](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-script-type.png)
5. アップロードしたスクリプトの内容を使用してフォームに入力し、スクリプトをデプロイします。
    
    ![スクリプトの設定](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-setup-script.png)
6. 利用者を選択すると、次のページが表示されます。外部 URL のスクリプト番号とデプロイ番号をメモします。これらは、RESTlet をコールするために必要です。
    
    ![スクリプトのデプロイ](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-script-deployment.png)

### [](#プロジェクトのインポート)プロジェクトのインポート

- \[File (ファイル)\] > \[Import (インポート)\] に移動します。
- \[Anypoint Studio\] フォルダーの下の \[External Location (外部の場所)\] から \[Anypoint Studio Project (Anypoint Studio プロジェクト)\] を選択します。
- デモプロジェクトフォルダーへのルートパスを指定します。
- Mule Runtime (4.1.1) 以降を選択します。
- \[Finish (完了)\] をクリックします。
- `src/main/resources/mule-app.properties`​ ファイル内でログイン情報、デプロイしたスクリプト、デプロイ ID を設定します。
    
    ```javascript
    netsuite.email=
    netsuite.password=
    netsuite.account=
    netsuite.roleId=
    netsuite.applicationId=
    netsuite.subsidiary=
    netsuite.script=
    netsuite.deploy=
    ```
    
    1. \[Global Element Configuration (グローバル要素の設定)\] を開きます。
    2. \[Test Connection (接続をテスト)\] ボタンをクリックして、Sandbox と接続されていることを確認します。
        
        接続のテストは重要なステップです。接続性に問題があると、このユースケースのどの部分も実行できず、DataSense を使用することもできません。
    3. ポップアップに成功メッセージが表示されます。
        
        ![接続のテスト](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-demo-connection-test.png)
    4. ブラウザーを開き、URL `http://localhost:8081`​ にアクセスします。 デプロイされたアプリケーションが表示されます。
        
        ![デモインデックス](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-demo-main-page.png)

### [](#フローについて)フローについて

1. html-form-flow: ​`parseTemplate`​ コンポーネントを使用して HTML フォームを表示します。
    
    ![フロー HTML フォーム](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-html-form-flow.png)
2. restletGet: RESTlet の GET 関数をコールします。
    
    ![フロー HTML フォーム](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-restlet-get.png)
3. restletPost: RESTlet の POST 関数をコールします。
    
    ![フロープロセッサー 1](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-restlet-post.png)
4. restletDelete: RESTlet の DELETE 関数をコールします。
    
    ![フロープロセッサー 1](/mulesoft/current/ja-jp/netsuite-connector/9.3/_images/netsuite-restlet-delete.png)

## [](#次のステップ)次のステップ

Studio を設定したら、[「例」](https://docs.mulesoft.com/jp/netsuite-connector/9.3/netsuite-examples)​トピックで詳細な設定アイデアを参照してください。

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

- [Anypoint Connector の概要](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [NetSuite Connector](https://docs.mulesoft.com/jp/netsuite-connector/9.3/)
- [NetSuite Connector 9.3 リファレンス](https://docs.mulesoft.com/jp/netsuite-connector/9.3/netsuite-reference)
- [MuleSoft ヘルプセンター](https://help.mulesoft.com)