У меня возникли проблемы с преобразованием заказа на продажу в выполнение номенклатуры. Вот мой код:
/**
* @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}