我们如何在 UserEvent SuiteScript 2.0 中获取记录类型?
我想为 1 种以上的记录类型(客户付款、贷记凭证、存款、发票)部署我的 SuiteScript
现在在我的 SuiteScript 中,我需要识别记录类型并根据它执行操作。
我的代码:
define(['N/record', 'N/https'],
function(record,https)
{
function afterSubmit(context)
{
var myUrl = 'My url here';
var rType = context.newRecord.Type;
log.debug({title: 'rType1 ', details: rType });
//This returns nothing
rType = record.Type;
log.debug({title: 'rType2 ', details: rType });
//This gives all the available record types in Netsuite
var JsonPayload = 'need to know whether its an invoice or a payment here';
log.debug({title: 'payload ', details: JsonPayload });
var response = https.post({ url: myUrl, body: JsonPayload});
log.debug({title: 'response ', details: response });
}
}
return {
afterSubmit: afterSubmit
};
});