ディスカッション
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
NetSuite の始め方 | N/record: record.load.promise(options)メソッド
前の記事NetSuiteの始め方 | SuiteScript 2.xモジュールの理解で、レコードの操作に使用されるSuiteScriptモジュールおよびN/recordモジュール、「NetSuiteの始め方 | N/recordモジュールの概要」を学習しました。次に、N/record: record.load.promise(options) Methodのメンバーの1つを詳しく確認します。
メソッドrecord.load.promise(options)は、record.load(options)のPromiseベースのバージョンであり、レコードの非同期ロードを可能にします。これは、SuiteScript 2.x SuiteScript 2.1または非同期プログラミングを利用するコンテキストで特に役立ちます。
構文
var recordPromise = record.load.promise(options);
パラメータ(オプション・オブジェクト):
- type (string)– レコードタイプ(例: 'salesorder'、'customer')
- ID (number|string)– レコードの内部ID
- [isDynamic] (ブール値)–trueの場合、動的モードでレコードをロードします(オプション、デフォルトはfalse)
- [defaultValues] (オブジェクト)– 選択フィールドのデフォルト値(オプション)
戻り値:
ロードされたRecordオブジェクトで解決されるPromise。
例: record.load.promiseを使用した非同期/待機の定期スクリプト
/**
* @NApiVersion 2 .1
* @NScriptType ScheduledScript
*/
define(['N/record', 'N/log'], function(record, log) {
//定期スクリプトのメインエントリポイント。
//定期スクリプトは自動的に以下のexecute関数を呼び出します。
const execute = async (context) => {
try {
// record.load.promiseを使用して、注文書レコードを非同期にロード
// '123'を、読み込む注文書の正しい内部IDに置き換えます
const soRecord = await record.load.promise({)
type: record.Type.SALES_ORDER、
ID: 123 //有効な内部IDを使用
});
//ロードされた注文書のトランザクションID(tranid)を記録します
log.debug({
title: 'Sales Order''
details: soRecord.getValue('tranid')
});
} catch (error) {
//レコードの読み込み中にエラーが発生した場合は、トラブルシューティングのためにエラーの詳細を記録します。
log.error({ 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!
- Expand your NetSuite knowledge by joining this month's Ask A Guru Live: PROCURE TO PAY. RSVP on this event now!
タグ付けされた:
0
