前回の記事「New to NetSuite | Understanding SuiteScript 2.x Modules」では、レコードを操作するために使用されるSuiteScript ModulesおよびN/recordモジュールについて、「New to NetSuite | N/record Module Overview」で説明しました。今回は、N/recordのメンバーの1つであるField.idプロパティについて詳しく見ていきます。
Field.idプロパティは読み取り専用の文字列で、標準フィールドまたはカスタムフィールド(ボディフィールドまたはサブリストフィールド)の内部IDを返します。
構文
var field = recordObj.getField({
fieldId: 'entity'
});
log.debug('Field ID', field.id);
戻り値の型
- 型: string(読み取り専用)
- 戻り値: フィールドの内部ID。
使用例
/**
* @NApiVersion 2 .1
* @NScriptType ScheduledScript
*/
define(['N/record', 'N/log'], (record, log) => {
function execute(context) {
// Load an existing Sales Order.
// Replace 123 with a valid internal ID in your NetSuite account.
var salesOrder = record.load({
type: record.Type.SALES_ORDER,
id: 123
});