megaphone
SuiteWorld 2026の登録が開始されました。今なら300ドル節約できます。 今すぐ登録しましょう

ディスカッション

NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.

NetSuite の始め方 | スブリストデータをSuiteletでアクセスする方法

NetSuiteのSuiteletを使用すると、カスタムページを作成できます。Suiteletの一般的な実装の一つは、ユーザーデータを取得して表示用に処理することです。Suiteletで作成されたフィールドにアクセスするには、ServerRequest.parametersを使用します。Suitelet内のサブリストデータにアクセスするために、SuiteScript 2.x APIは次の2つのメソッドを提供します:ServerRequest.getLineCount(options)とServerRequest.getSublistValue(options)。 

  • ServerRequest.getLineCount(options)は、サブリストの合計行数を返します。 
  • ServerRequest.getSublistValue(options)は、特定のサブリスト行項目の値を返します。 

以下に、これらのメソッドの使用例を示します: 

/** 
 * @NApiVersion 2.x 
 * @NScriptType Suitelet 
 */ 
define(['N/ui/serverWidget', 'N/log'], function(serverWidget, log) { 
    function onRequest(context) { 
        if (context.request.method === 'GET') { 
            var form = serverWidget.createForm({ 
                title: 'サンプルSuiteletフォーム' 
            }); 
 
            // フォームにフィールドを追加 
            form.addField({ 
                id: 'custpage_field', 
                type: serverWidget.FieldType.TEXT, 
                label: 'サンプルフィールド' 
            }); 
 
            // フォームにサブリストを追加 
            var sublist = form.addSublist({ 
                id: 'custpage_sublist', 
                type: serverWidget.SublistType.INLINEEDITOR, 
                label: 'サンプルサブリスト' 
            }); 
 
            // サブリストにフィールドを追加 
            sublist.addField({ 
                id: 'custpage_sublist_field1', 
                type: serverWidget.FieldType.TEXT, 
                label: 'サブリストフィールド1' 
            }); 
 
            context.response.writePage(form); 
        } else { 
            var request = context.request; 
            var lineCount = request.getLineCount({ sublistId: 'custpage_sublist' }); 
            for (var i = 0; i < lineCount; i++) { 
                var sublistValue = request.getSublistValue({ 
                    sublistId: 'custpage_sublist', 
                    fieldId: 'custpage_sublist_field1', 
                    line: i 
                }); 
                log.debug('Sublist Value', sublistValue); 
            } 
        } 
    } 
 
    return

Richard James Uri - SuiteCloud | WMS Tech | SuiteCommerce Advanced

----

Admin Tips.gif
タグ付けされた:

ようこそ!

サインイン

完全な詳細を表示するには、サインインしてください。

登録

アカウントがありませんか?ここをクリックして始めましょう!

リーダーボード

コミュニティの達人

第2四半期 (4月~6月 2026)

今週のリーダー

今月のリーダー

歴代リーダー