Javascript 如何在UserEvent SuiteScript 2.0中获取记录类型
如何在UserEvent SuiteScript 2.0中获取记录类型 我想为1种以上的记录类型(客户付款、信用备忘录、存款、发票)部署SuiteScript 现在,在我的SuiteScript中,我需要识别记录类型并根据它执行操作 我的代码:Javascript 如何在UserEvent SuiteScript 2.0中获取记录类型,javascript,netsuite,suitescript2.0,Javascript,Netsuite,Suitescript2.0,如何在UserEvent SuiteScript 2.0中获取记录类型 我想为1种以上的记录类型(客户付款、信用备忘录、存款、发票)部署SuiteScript 现在,在我的SuiteScript中,我需要识别记录类型并根据它执行操作 我的代码: define(['N/record', 'N/https'], function(record,https) { function afterSubmit(context) { var myUrl = 'My url he
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
};
});
应为
ctx.newRecord.type
。javascript区分大小写 @bkinghts非常感谢。现在可以了。另一个问题:当向发票付款时,发票上的应付金额会更新。但这不会触发我的脚本?是因为它是一个用户事件脚本吗?如果是,我应该将其更改为什么以使其工作?这将是客户付款记录上的用户事件。注意:您可能还需要将脚本部署到信用备忘录和客户存款中