我目前在程序集构建的库存详细信息子记录的客户端脚本编写方面遇到了一些问题 . 如您所知,Assembly Builds有两个Inventory Details . 右上角的那个按预期工作,我可以使用Suitescript访问每个字段 .
我在底层库存细节方面遇到了麻烦 . 我能够访问它并使用nlapiGetFieldValue()就好了 . 但是,当我访问子列表时,我只能查找'id'的值 .
这些是应该存在的字段,以及一个名为“receiptinventorynumber”的记录较少的字段 .
这是我的代码:
//get the line items in the bottom inventory details
var bottom_line_items = [];
for(var line_index = 0; line_index < nlapiGetLineItemCount("component"); line_index++)
{
var bottom_inv_detail = nlapiViewLineItemSubrecord("component", 'componentinventorydetail', line_index+1);
if(bottom_inv_detail != null)
{
var bottom_line_count = bottom_inv_detail.getLineItemCount('inventoryassignment');
for(var index =0; index < bottom_line_count; index++)
{
bottom_inv_detail.selectLineItem('inventoryassignment', index+1);
var sn = bottom_inv_detail.getCurrentLineItemValue('inventoryassignment', 'receiptinventorynumber');
bottom_line_items.push(sn);
}
}
}
console.log(bottom_line_items);
以下是在浏览器控制台中执行它的结果:
如您所见,'id'和'internalid'工作 . 'receipttinventorynumber'没有 . 也没有任何其他领域 .
由于我的用例,我不能等待将记录保存在服务器上 . 我必须 grab 这个客户端 . 任何建议表示赞赏 .
2 回答
自从我使用Inventory Detail子记录以来已经很长时间了,但我认为还有另一个名为'assigninventorynumber'的字段 . 你尝试过使用它吗?
只是能够回答我自己的问题,但它最终涉及服务器端搜索 . 我很确定它能像我想要的那样工作,但我仍然参与测试它 . 本质上,我 grab 了'issueinventorynumber'这个有id的字段 . 该ID是“库存序列号”的内部信息,我可以执行搜索以获取实际数量 . 这是结果代码: