ディスカッション

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.

SuiteScriptを使用してサブリストにオプションを動的に追加する

編集済:Jun 2, 2025 2:48PM SuiteCloud / カスタマイズ

適用

製品:  NetSuite 2023.1



シナリオ

ユーザーは、SuiteScriptを使用してサブリストにオプションを動的に追加したいと考えています。値は検索から取得されます。このシナリオでは、オプション値は特定の連結から取得され、Suiteletフォームに追加された在庫アイテムとなっています。



解決策

サンプルSuiteleスクリプト

SuiteScript 1.0

function main(request, response) {

    var form = nlapiCreateForm('Items', false);

    var sublist = form.addSubList('custpage_items', 'inlineeditor', 'Items');

    var itemField = sublist.addField('custpage_item', 'select', 'Item');

    form.setScript('customscript_populate'); //クライアントスクリプトを設定

    response.writePage(form);

}


SuiteScript 2.0

var form = serverWidget.createForm({ title: 'Items' });

var sublist =  form.addSublist({ id:'custpage_items',

                                 label: 'Items',

                                 type : serverWidget.SublistType.INLINEEDITOR });

var itemField = sublist.addField({ id: 'custpage_item',

                                   label: 'Item',

                                   type:  serverWidget.Type.SELECT })

form.clientScriptFileId = 32; //フォームに使用するクライアントスクリプトファイルの内部ID

context.response.writePage(form);


サンプルクライアントスクリプト

SuiteScript 1.0

function pageInit() {

    nlapiRemoveLineItemOption('custpage_items', 'custpage_item'); //現在の選択オプションを削除 

    nlapiInsertLineItemOption('custpage_items', 'custpage_item', '', '', true); //Null値を挿入して、デフォルト値とする

    var filters = new Array();

    filters[0] = new nlobjSearchFilter('type',null,'is','InvtPart'); /アイテムの種類は在庫アイテム

タグ付けされた:

ようこそ!

サインイン

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

登録

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

リーダーボード

コミュニティの達人

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

今週のリーダー

今月のリーダー

歴代リーダー