我正在尝试使用以下代码在用户事件脚本中通过SuiteScript 2.0检索“调整库存”表单的“库存详细信息”字段。脚本最终需要验证批号是否增加了1。
error: SMTP: authentication failed
和lines
返回newIventoryDetails
和{"details":"SS lines: 1"}
但是行
{"details":"SS newIventoryDetails: standard subrecord"}
返回 var lotNumber = newIventoryDetails.getValue({
fieldId: 'issueinventorynumber'
});
log.debug({details: "SS lotNumber: " + lotNumber});
以获取批号。有谁知道我要去哪里错了?
{"details":"SS lotNumber: undefined"}
答案 0 :(得分:1)
此更改已解决:
function beforeSubmit(context) {
log.debug({details: "SS beforeSubmit: " + context.type});
var newRecord = context.newRecord; // The new record being submitted.
if (newRecord.isDynamic) {
log.debug({details: "SS isDynamic: true"}); // currentRecord is Dynamic.
} else {
log.debug({details: "SS isDynamic: false"});
}
// Check how many lines exist in the inventory sublist.
var lines = newRecord.getLineCount({sublistId: 'inventory'});
log.debug({details: "SS lines: " + lines});
var newIventoryDetails = newRecord.getSublistSubrecord({
sublistId: 'inventory',
fieldId: 'inventorydetail',
line: 0
});
log.debug({details: "SS newIventoryDetails: " + newIventoryDetails});
var lotNumber = newIventoryDetails.getSublistText({ // getSublistValue
sublistId: 'inventoryassignment',
fieldId: 'issueinventorynumber',
line: 0
});
log.debug({details: "SS lotNumber: " + lotNumber});
}