尝试从已提交的sales_order中获取新数据以将其发布到远程数据库。 尝试先让这些小片段起作用。
由于某些原因,两种状态返回相同。
/**
* 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;
});