netsuite - 从销售订单到项目履行错误的转换
问题描述
我在将销售订单转换为商品履行时遇到了一些问题。这是我的代码:
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
define(['N/record', 'N/log'],
function(record, log) {
function afterSubmit(context) {
var orderId = context.newRecord.id;
var fulfillmentRecord = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: orderId,
toType: record.Type.ITEM_FULFILLMENT,
isDynamic: true
});
fulfillmentRecord.setValue({
fieldId: 'location',
value: 'San Francisco'
});
log.error({
title: 'Debug Entry',
details: fulfillmentRecord
});
var rid = fulfillmentRecord.save();
}
return {
afterSubmit: afterSubmit
};
});
我不断收到此错误,这有点令人困惑,因为我不知道“堆栈”是什么意思:
{"type":"error.SuiteScriptError",
"name":"USER_ERROR",
"message":"Please provide values for the following fields in the Items list: Location",
"stack":["anonymous(N/serverRecordService)",
"afterSubmit(/SuiteScripts/fulfillmentCreator.js:23)"],
"cause":{
"type":"internal error",
"code":"USER_ERROR",
"details":"Please provide values for the following fields in the Items list: Location",
"userEvent":"aftersubmit",
"stackTrace":["anonymous(N/serverRecordService)","afterSubmit(/SuiteScripts/fulfillmentCreator.js:23)"],"notifyOff":false},"id":"","notifyOff":false}
解决方案
我看到您已经在标题处设置了位置字段,但根据错误,您还需要在项目子列表上设置位置字段。
推荐阅读
- node.js - 在 Docker Compose 下将 OpenTelemetry 跟踪信息从我的应用程序获取到 jaeger 时遇到问题
- r - 如何从矩阵中复制一行并将其设置为r中另一个矩阵中的一行?
- postscript - 保存到 postscript 时符号显示不正确
- sql - CTE 与子查询
- sql - 动态调整选择字段 - PostgreSQL
- unreal-engine4 - Unreal 4.25 - 在画布上绘制文本不会刷新
- javascript - 最少的硬币,仅使用条件语句
- mysql - 如何获取外键的属性
- f# - 为非本地收件人丢弃消息 [Akka.Actor.ActorSelectionMessage]
- python - 非二叉树遍历方法