ディスカッション
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.submitFields(options)メソッド
前の記事NetSuiteの始め方 | Understanding SuiteScript 2.x Modulesで、レコードの操作に使用されるSuiteScriptモジュールおよびN/recordモジュールNetSuiteの始め方 | N/record Module Overviewを学習しました。次に、N/record: record.submitFields(options) Methodの1つを詳しく確認します。
record.submitFields(options)メソッドを使用すると、レコード全体をロードせずに、既存のレコードの1つ以上のフィールドをすばやく更新できます。これは、パフォーマンスの最適化および単純なフィールド更新に役立ちます。
record.submitFields()を使用して、次を編集および送信できます。
- インライン編集をサポートする標準ボディ・フィールド
- インライン編集をサポートするカスタム・ボディ・フィールド
- 選択フィールドと複数選択フィールド
このメソッドは、次をサポートしていません:
- サブリスト(ライン・レベル)フィールド
- サブレコード・フィールド(住所フィールドなど)
構文
require(['N/record'], function(record) {
record.submitFields({
type: 'salesorder', // 文字列リテラルまたはrecord.Type.*定数としてのレコード・タイプ
id: 12345, // 更新するレコードの内部ID
values: { // フィールドIDとその新しい値を持つJavaScriptオブジェクト
memo: 'New memo text'
},
options: { enableSourcing: false, ignoreMandatoryFields: true } // オプション
});
});
パラメータ
- タイプ(文字列またはrecord.Type):レコード・タイプ(例: 'customer'、 'salesorder')
- ID (number):更新するレコードの内部ID。
- 値(オブジェクト):キーと値のペア。各キーはフィールドIDで、値は新しいフィールド値です。
フィールド・タイプ | 可能な値 |
|---|---|
テキスト、ラジオ、選択、複数選択 | 文字列 |
チェック・ボックス | ブール値 |
日付/ DateTime | 日付オブジェクト |
整数、浮動小数、通貨、パーセント | 番号 |
- options (オブジェクト、オプション):
- enableSourcing (ブール): trueの場合、フィールドの変更時にソースがトリガーされます(デフォルト: false)。
- ignoreMandatoryFields (ブール): trueの場合、必須フィールドは強制されません(デフォルト: false)。
スケジュール済SuiteScriptでのrecord.submitFields()の使用例
/**
* @NApiVersion 2 .1
* @NScriptType ScheduledScript
*/
define(['N/record', 'N/log'], function(record, log) {
function execute(context) {
try {
// 適切なレコード・タイプおよびinternalIdに置き換えます
var recordType = record.Type.CUSTOMER;
var recordId = 12345;
// フィールド更新の準備
var fieldValues = {
email: 'updated.email@example .com', // 電子メール・フィールドを更新します
comments: 'Updated via scheduled script' // コメント/メモ・フィールドの更新 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
