ディスカッション
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
We'd love to hear your thoughts on the Latest updates in the NetSuite Support Community (UI/UX edition) – December 2025. Your feedback is important to us—please let us know what you think or any suggestions you may have in the comments!
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
----
- NetSuite Admin Corner | New to NetSuite
- Explore the NSC Webinars Category
- Join our poll and share your ideas! We want to know what you think. Don't forget to comment and make your voice heard!
タグ付けされた:
0
