ディスカッション
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Update: Narrative Insights has been restored and is now available.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
編集モードでページ起動イベントを実行した際にラインアイテムを削除する
適用
製品: NetSuite 2020.1
シナリオ
ユーザーは、編集を初期化するときに、注文書レコードの特定のラインアイテムを削除するソリューションを実装したいと考えています。
この場合、カスタムのトランザクションラインフィールドを使用して、ラインアイテムを削除する必要があるかどうかを決定する。
解決策
- カスタムトランザクションラインフィールドを作成
- カスタマイゼーション > リスト、レコードおよびフィールド > トランザクションラインフィールド > 新規に移動
- トランザクション ライン フィールド ページで:
- ラベル: ラインアイテムの削除を記入
- 種類:チェックボックスを選択
- サブタブに適用:
- 販売アイテム: チェックマークを入力
- 保存してフォームに適用 をクリック
- pageInit 関数を使用してクライアント スクリプトを作成する
- SuiteScript 1.0:
function deleteLineItemsOnPageInit(type){ if (type == 'edit') { var itemCount = nlapiGetLineItemCount('item'); for (var i = itemCount; i>0; i--) { nlapiSelectLineItem('item', i); var itemLineCB = nlapiGetCurrentLineItemValue('item', 'custcol7'); if(itemLineCB == 'T'){ nlapiRemoveLineItem('item'); } } } } - SuiteScript 2.0:
function deleteLineItemsOnPageInit(scriptContext){ if (scriptContext.mode = 'edit') var record = scriptContext.currentRecord var itemCount = record.getLineCount({sublistId: 'item'}) for (var i = itemCount; i>0; i--) { record.selectLine({ sublistId: 'item', line: i }); var itemLineCB = record.getCurrentSublistValue({ sublistId: 'item', fieldId: 'custcol7' //scriptId of the Custom Transaction Field created in Step 1 }); if(itemLineCB == 'T'){ record.removeLine({ sublistId: 'item', line: i; }) } } }
- SuiteScript 1.0:
- カスタマイズゼーション > スクリプト > スクリプト > 新規 に移動
- 新規 > ファイルを選択 > スクリプトファイルを選択 > 保存 > スクリプトレコードを作成 をクリック
- SuiteScript 1.0 を使用している場合:
- クライアントスクリプトをクリック
- スクリプトの記録ページで:
- 名前: ラインアイテムの削除を入力
- スクリプトサブタブ:
- ページ初期化関数: deleteLineItemsOnPageInit と入力
- 保存&デプロイをクリック
注::SuiteScript 2.0 を使用している場合は、スクリプトの種類を選択する必要はありません。
- SuiteScript 1.0 を使用している場合:
- スクリプトデプロイページで:
- 適用先: 注文書を選択
- ステータス:リリース済みを選択
- デプロイ済み:チェックマークを入力
- ログレベル:デバッグを選択
- 閲覧者タブで:
- ロール: チェックマークを入力
- 保存をクリック
タグ付けされた:
0