ディスカッション
AIを用いた自動化で請求書処理を合理化
AIを用いた考察を使用して、計画と予測を迅速化
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
NetSuite の始め方|N/record: record.create(options)モジュール
前回の記事「NetSuiteの始め方|SuiteScript 2.xモジュールの基本」ではSuiteScriptモジュールとN/recordモジュールの概要について解説しました。今回は、そのメンバーの1つであるN/record: record.create(options)モジュールに焦点を当てます。
record.create(options)関数は、SuiteScript 2.xのN/recordモジュールの一部です。この関数は新しい空のレコードオブジェクトを生成し、必要なデータを入力してシステムに保存できるようにします。
たとえば、次のような用途で使われます:
- 自社ウェブサイトで新規リードが登録された際に顧客(Customer)レコードを作成する
- トランザクションが処理された際に自動で注文書(Sales Order)を作成する
パラメータの詳細
ここでは、record.create(options)内の各パラメータの意味と、その効果的な使い方を説明します。
パラメーター | タイプ | Required | 説明 |
|---|---|---|---|
options.type | string | Required |
|
options.isDynamic | boolean | Optional |
|
options.defaultValues | Object | Optional | - カスタムレコードの場合は、"customrecord_employee_expense"のようなレコードの文字列IDを指定します。これにより、どの種類のレコードを作成するかが明確になります。 |
例: SuiteScriptを用いて顧客レコードを作成する
/**
* @NApiVersion 2 .x
* @NScriptType ScheduledScript
*/
define(['N/search', 'N/record', 'N/log'], function(search, record, log) {
function execute(context) {
var customerRecord = record.create({
type: record.Type.CUSTOMER,
isDynamic: true
});
customerRecord.setValue({
fieldId: 'companyname',
value: 'Sample Corporation'
});
var customerId = customerRecord.save();
return customerId;
}
return {
execute: execute
};
});
Line(s) | Purpose |
|---|---|
/ ... */ | ・スクリプトヘッダー:このスクリプトがSuiteScript 2.xであり、種類はスケジュールスクリプトであることを定義します。 |
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 about Advanced Accounting. RSVP on this event now!
