ディスカッション

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.

重複する可能性のあるオーダー番号を検出する単純なスクリプトの実行

編集済:Jul 25, 2024 8:12AM SuiteCloud / カスタマイズ

適用

製品:  NetSuite 2022.1

シナリオ

場合によっては、レコードが重複していることをユーザーに警告する必要があります。この場合は、注文書を参照します。

解決策

ユーザーが同じ顧客の既存の注文書番号を作成した後にエラーメッセージを表示するには、次のようにします。

以下の様ににフィルターを設定します。

var filters = new Array();

filters[0] = new nlobjSearchFilter('entity', null, 'is', entityID);

filters[1] = new nlobjSearchFilter('otherrefnum', null, 'equalTo', custPo);

filters[2] = new nlobjSearchFilter('mainline', null, 'is', 'T');

列を次のように設定します。

var columns = new Array();

columns[0] = new nlobjSearchColumn('entity');

columns[1] = new nlobjSearchColumn('otherrefnum');

検索を実行します。

var searchResult = nlapiSearchRecord('salesorder', null, filters, columns);

if (searchResult != null) {

for (var x = 0; x < searchResult.length; x++) {

var customerID = searchResult[x].getValue('entity');

nlapiLogExecution('DEBUG', 'Customer ID', "Customer ID: " + customerID)

var customerPurchOrd = searchResult[x].getValue('otherrefnum')

nlapiLogExecution('DEBUG', 'Sales Order Number', "Sales Order Number: " + customerPurchOrd)

}

if (customerID[0] != null && customerPurchOrd[0] != null) {

var err = nlapiCreateError('Existing record', '', true);

throw err;

}

}

return true;

免責事項

ここに記載されているサンプルコードは、法律で認められている最大限の範囲で、いかなる種類の保証もなく、「現状のまま」で提供されています。Oracle+NetSuite社は、開発者がそれぞれの開発プラットフォームにサンプルコードを実装したり、独自の Web サーバー構成を使用したりする際に、個々の成功を保証するものではありません。

ようこそ!

サインイン

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

登録

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

リーダーボード

コミュニティの達人

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

今週のリーダー

今月のリーダー

歴代リーダー