Netsuite 复制供应商账单上的自定义拒绝原因
我正在尝试实施suiteanswer ID 74548,并创建了一个自定义记录,以捕获供应商账单拒绝原因,因为我们的审批人具有员工中心角色, 只允许查看账单。我能够正确地捕获原因,但在修改示例脚本以适应供应商账单之后,由于输入不正确,它仍然在submitFields出错。我只想从自定义记录中获取拒绝原因,并在当前供应商账单拒绝原因(屏幕上添加的自定义字段)上更新它 你能检查一下脚本并帮我更正一下吗 错误:Netsuite 复制供应商账单上的自定义拒绝原因,netsuite,Netsuite,我正在尝试实施suiteanswer ID 74548,并创建了一个自定义记录,以捕获供应商账单拒绝原因,因为我们的审批人具有员工中心角色, 只允许查看账单。我能够正确地捕获原因,但在修改示例脚本以适应供应商账单之后,由于输入不正确,它仍然在submitFields出错。我只想从自定义记录中获取拒绝原因,并在当前供应商账单拒绝原因(屏幕上添加的自定义字段)上更新它 你能检查一下脚本并帮我更正一下吗 错误: {“type”:”error.SuiteScriptError”,”name”:”SSS_
{“type”:”error.SuiteScriptError”,”name”:”SSS_MISSING_REQD_ARGUMENT”,”message”:”submitFields: Missing a required argument: id”,”stack”:[“createError(N/error)”,”afterSubmit(/SuiteScripts/Rej Reason Test.js:60)”,”createError(N/error)”],”cause”:{“name”:”SSS_MISSING_REQD_ARGUMENT”,”message”:”submitFields: Missing a required argument: id”},”id”:””,”notifyOff”:false,”userFacing”:true}
代码示例:
/**
* u/NApiVersion 2.x
* u/NScriptType UserEventScript
* u/NModuleScope SameAccount
*/
define(['N/record'],
function(record) {
/**
* Function definition to be triggered before record is loaded.
*
* u/param {Object} scriptContext
* u/param {Record} scriptContext.newRecord - New record
* u/param {string} scriptContext.type - Trigger type
* u/param {Form} scriptContext.form - Current form
* u/Since 2015.2
*/
function beforeLoad(scriptContext)
{
}
/**
* Function definition to be triggered before record is loaded.
*
* u/param {Object} scriptContext
* u/param {Record} scriptContext.newRecord - New record
* u/param {Record} scriptContext.oldRecord - Old record
* u/param {string} scriptContext.type - Trigger type
* u/Since 2015.2
*/
function beforeSubmit(scriptContext)
{
}
/**
* Function definition to be triggered before record is loaded.
*
* u/param {Object} scriptContext
* u/param {Record} scriptContext.newRecord - New record
* u/param {Record} scriptContext.oldRecord - Old record
* u/param {string} scriptContext.type - Trigger type
* u/Since 2015.2
*/
function afterSubmit(scriptContext)
{
// Get the value of the Reject reason
var rejReason = scriptContext.newRecord.getValue({
fieldId: 'custrecord165' // Change this according to the internal id of the Field Reject Reason in the Custom Record Created
});
// Get the ID of the Vendor Bill Reject reason
var venbillID = scriptContext.newRecord.getValue({
fieldId: 'custrecord166' // Change this according to the internal id of the Field Vendor Bill in the Custom Record Created
});
// populate the Reject Reason in the Vendor Bill Rejection Reason field
var id = record.submitFields({
type: record.Type.VENDOR_BILL,
id: venbillID,
values: {
custrecord165: rejReason // Change custbody1 to the internal id of the custom field Reject Reason in the Vendor Bill Record
},
options: {
enableSourcing: false,
ignoreMandatoryFields : true
}
});
}
return {
beforeLoad: beforeLoad,
beforeSubmit: beforeSubmit,
afterSubmit: afterSubmit
};
});