ディスカッション
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 の始め方| N/record: record.submitFields.promise(options)メソッド
前の記事NetSuiteの始め方 | SuiteScript 2.x Modulesで、レコードの操作に使用されるSuiteScriptモジュールおよびN/recordモジュールNetSuiteの始め方 | N/record Module の概要を学習しました。次に、N/record: record.submitFields.promise(options) Methodのメンバーの1つを詳しく確認します。
record.submitFields.promise(options)メソッドは、record.submitFieldsファンクションの非同期バージョンです。これにより、レコード全体をロードせずに既存のレコードの特定のフィールド値を更新でき、更新が完了したときに解決される確約が返されます。
次の場合は、record.submitFields.promise()を使用します。
- インライン編集をサポートする標準ボディ・フィールドをすばやく更新
- インライン編集をサポートするカスタム本文フィールドの更新
- record.load()およびrecord.save()を回避してパフォーマンスを向上
- 非同期スクリプトでの更新の実行(Map/Reduce、Scheduled、asyncなどの機能)
この方法にはいくつかの制限があります。これを使用して次のものを更新することはできません。
- フィールドの選択
- サブリストまたはライン・アイテムのフィールド
- サブレコード・フィールド(住所フィールドなど)
構文
record.submitFields.promise(オプション)
パラメータ
options:次のプロパティを持つオブジェクト(オブジェクト)。
- type (string):レコード・タイプ(record.Type.SALES_ORDERなど)
- ID (number|string):更新するレコードの内部ID
- 値(オブジェクト):フィールドIDと新しい値のマッピング
- options (Object): (オプション)追加オプション
- enablesourcing(Boolean): 更新時のフィールド・ソーシングを有効にします。
- ignoreMandatoryFields(ブール): 必須フィールドが欠落している場合でもレコードを保存できます。
次に、record.submitFields.promise(options)の使用方法の例を示します
/**
* @NApiVersion 2 .1
* @NScriptType ScheduledScript
*/
define(['N/record', 'N/log'], (record, log) => {
/**
* The main entry point for the scheduled script.
*/
const execute = async (context) => {
// 更新する顧客レコードのID
const customerId = 12345;
// 顧客の新規Eメール・アドレス
const newEmail = 'newemail@example .com';
try {
// submitFields.promiseを使用して顧客の電子メールを非同期に更新
await record.submitFields.promise({
type: record.Type.CUSTOMER, // Specify record type 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
