我正在尝试查看客户付款数据的“应用”子列表中的值是否已更改并根据它执行一些操作。
我的 SuiteScript 如下:
define(['N/record', 'N/https'],
function(record,https)
{
function afterSubmit(context)
{
var oldRec = context.oldRecord;
log.debug({title: 'oldRec ', details: oldRec });
// This log shows that the JSON has an
// attribute called sublists which contains "apply" which has all the applied payments
// eg: {"id":"1234", "type":"customerpayment", "fields":{all the fields},
// "sublists": {"apply" : {"line 1"...}}}
var oldRecSublists = oldRec.sublists;
log.debug({title: 'oldRecApply ', details: oldRecSublists });
// This returns empty or null though there is data
我在这里做错了什么?
基本上我想要实现的是比较 context.oldRecord.sublists.apply 和 context.newRecord.sublists.apply 以查找 amt 是否已更改。
有没有更好的方法是 SuiteScript 2.0?
提前致谢!