子列表名称未记录且不受官方支持,但您仍然可以使用子列表 ID“locations”,IE 访问它
//load arbitrary item record
var itemRec = nlapiLoadRecord('inventoryitem', 655009)
//find the line with location internal ID 1
var line = itemRec.findLineItemValue('locations','location',1);
//get that line's location count interval
var countinterval = itemRec.getLineItemValue('locations', 'invtcountinterval', line);
//calculate the next count date as today + interval, set up the
//last count date as a string
var lastCountDate = nlapiDateToString(new Date());
var nextCountDate = new Date() + countInterval*MILLISECONDS_IN_DAY;
nextCountDate = nlapiDateToString(nextCountDate);
//set the values on the item
itemRec.setLineItemValue('locations','lastinvtcountdate', line, lastCountDate);
itemRec.setLineItemvalue('locations','nextinvtcountdate', line, nextCountDate);
nlapiSubmitRecord(itemRec);
您可以通过在子列表界面上使用 chrome 中的“检查元素”之类的内容来发现子列表的字段名称。例如,右键单击任何项目的位置子列表上的“下一个库存盘点日期”标题,然后单击“检查元素”。查看出现的 div.listheader,在其上方,您会看到类似
.elements['locationssortfld'].value='nextinvtcountdate'
'nextinvtcountdate' 将是您插入到 nlapiSetLineItemValue 的字段参数中的字段 ID。
希望对某人有所帮助。我第一次自己解决了这个问题,虽然现在看起来更明显了。