前回の記事「New to NetSuite | Understanding SuiteScript 2.x Modules」では、レコードを操作するために使用されるSuiteScript ModulesおよびN/recordモジュールについて、「New to NetSuite | N/record Module Overview」で説明しました。今回は、N/record のメンバーの 1 つである Column.type プロパティを詳しく見ていきます。
Column.type プロパティは、サブリストから返される Column オブジェクトに属します。このプロパティは、フィールド(列)のデータ型を示します。
構文
var fieldType = column.type;
使用例
販売注文の明細サブリストにある品目フィールドの型を確認するとします。
/**
* @NApiVersion 2 .1
* @NScriptType ScheduledScript
*/
define(['N/record', 'N/log'], (record, log) => {
function execute(context) {
// Load an existing Sales Order
var salesOrder = record.load({
type: record.Type.SALES_ORDER,
id: 123 // Replace with a valid Sales Order internal ID
});
// Get the "quantity" field