我'm new to NetSuite scripting. I'm尝试使用以下数据填充 Item Fulfillment 表单中的3个自定义正文字段:行项目名称,行项目类别和行项目计数(履行表单中的行项目总数) .
为此,我使用 nlapiGetCurrentLineItemText('item', 'class');
获取行项目的类, nlapiGetCurrentLineItemText('item', 'item');
获取名称,使用 nlapiGetLineItemCount('item');
获取行项目计数 . 并 nlapiSetFieldValue
填充字段 .
我将此脚本设置为在 Page Init event 上运行(不确定's the appropriate event). I' m是否有两个问题:
-
当“实施销售订单”页面运行时,类和项目计数正在填充,但项目名称字段未填充 . 有什么想法吗?
-
当我执行批量履行(在“履行订单”页面中一次履行多个订单)时,不会填充任何字段 . 它's like the script would only run when fulfilling orders manually, but not when it'是自动批量完成的 . 对那个有什么想法吗?
第二个问题可能是最关键的问题,因为当我们在一天内完成100-200个订单时,有能力自动履行订单并获得填充的正确字段 .
希望我尽可能清楚地解释自己 . 谢谢你的帮助!!
这是当前的脚本:
function pageInit() {
{
var category = nlapiGetCurrentLineItemText('item', 'class');
var sku = nlapiGetCurrentLineItemText('item', 'item');
var count = nlapiGetLineItemCount('item');
nlapiSetFieldValue('custbody_itemcategory', category);
nlapiSetFieldValue('custbody_itemsku', sku);
nlapiSetFieldValue('custbody_skucount', count);
}
}
1 回答
对于#1,你得到的是ItemText而不是值 . 我假设custbody_itemsku是Item的List / Record字段 . 如果是这种情况,请使用:
var sku = nlapiGetCurrentLineItemValue('item', 'item');
对于#2,在执行批量实现时不会触发客户端脚本 . 请改用用户事件脚本 . 您可以填充
beforeSubmit
上的字段 .