我正在尝试使用下面的代码从两个交易正文字段获取值。
/**
*@NApiVersion 2.x
*@NScriptType UserEventScript
*@param {Record} context.currentRecord
*/
define(['N/record'],
function (msg) {
function beforeSubmit(context) {
try {
var record = context.currentRecord;
var createdDate = record.getValue({
fieldId: 'createddate'
});
var dataNecessidade = record.getValue({
fieldId: 'custbodyek_data_nece_requ_po'
});
console.log(createdDate ,dataNecessidade);
}
catch(ex){
log.error(ex);
}
}
return {
beforeSubmit : beforeSubmit,
};
});
引发的错误是“TypeError:无法调用未定义的方法“getValue””
我在这里做错了什么?
谢谢!
最佳答案
传递到用户事件的 context
上没有 currentRecord
属性,因此错误消息告诉您 record
未定义。查看 beforeSubmit
入口点的文档以查找适当的值。
关于javascript - SuiteScript 2.0 TypeError 无法调用未定义的方法 "getValue",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65413523/