Netsuite scriptContext.oldRecord和scriptContext.newRecord返回相同的内容

时间:2019-02-22 01:08:11

标签: netsuite

尝试从已提交的sales_order中获取新数据以将其发布到远程数据库。 尝试先让这些小片段起作用。

由于某些原因,两种状态返回相同。

enter image description here

/**
 * User Event 2.0 example detailing usage of the Submit events
 *
  @NApiVersion 2.x
  @NModuleScope SameAccount
  @NScriptType UserEventScript
  @appliedtorecord salesorder
 */

define(['N/runtime'], function(runtime) {
  var exports = {};

  function afterSubmit(scriptContext) {
    var salesOrder = scriptContext.newRecord;
    var prevSalesOrder = scriptContext.oldRecord;

    var status = salesOrder.getValue({ fieldId: 'status' });
    var prevStatus = prevSalesOrder.getValue({ fieldId: 'status' });

    log.audit({ title: 'New', details: status });
    log.audit({ title: 'Old', details: prevStatus });
  }

  exports.afterSubmit = afterSubmit;
  return exports;
});

0 个答案:

没有答案