ディスカッション
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
Community Articles: What Topic Should We Cover Next? Your idea could be our next feature—drop your suggestion now and spark the next big discussion!
NetSuite管理者ヒント| SuiteScriptを使用した仕入先支払請求書メモおよび部門の一括更新
管理者は、多くの場合、複数のトランザクションの「メモ」フィールドや「部門」フィールドの更新など、仕入先支払請求書レコードに対して一括更新を実行する必要があります。各レコードを個別にロードおよび保存すると、時間がかかり、不要なガバナンスが消費される可能性があります。
より効率的な方法は、スケジュール済スクリプト内のrecord.submitFields.promise()を使用して、必要な標準ボディ・フィールドのみを更新することです。
この方法では、次のことが可能です。
- 標準ボディ・フィールドのみ更新
- record.load()およびrecord.save()を使用しないでください。
- スクリプトのパフォーマンスとガバナンスの使用率を向上
- レコードを安全に一括処理
例: 仕入先支払請求書メモおよび部門の一括更新
- mainline = Tを使用して仕入先支払請求書を検索します
- 「メモ」および「部門」フィールドを更新します。
- 正常な更新とエラーを記録して、監視を容易に
/**
* @NApiVersion 2 .1
* @NScriptType ScheduledScript
*/
define(['N/record', 'N/search', 'N/log'], (record, search, log) => {
/**
* Entry point for the scheduled script.
*/
const execute = async (context) => {
// 最新の仕入先支払請求書の検索
const vendorBillSearch = search.create({
type: record.Type.VENDOR_BILL,
filters: [['mainline', 'is', 'T']],
columns: ['internalid']
});
// この例の仕入先支払請求書IDを最大5つ収集します
let vendorBillIds = [];
vendorBillSearch.run().each(result => {
vendorBillIds.push(result.getValue({ name: 'internalid' }));
return vendorBillIds.length < 5; // Limit for demonstration
});
// 各仕入先支払請求書の更新
for (let billId of vendorBillIds) {
try {
await record.submitFields.promise({
type: record.Type.VENDOR_BILL,
id: billId,
values: {
memo: 'Updated by Scheduled Script',
department: 2 // Set to department internal ID as an example
}
});
log.audit( 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
