NetSuite:TypeError record.createCurrentLineItemSubrecord不是函数吗?

时间:2019-10-20 17:24:17

标签: javascript netsuite suitescript clientscript

我要

  

“ TypeError _invadjtransRecord.createiewCurrentLineItemSubrecord不是函数”

尝试以下代码时:

var _invadjtransRecord = nlapiCreateRecord('inventoryadjustment');

_invadjtransRecord.setFieldValue('subsidiary', _subsidiary);
_invadjtransRecord.setFieldValue('account', _itemAccount);
_invadjtransRecord.setFieldValue('trandate',dateVal);
_invadjtransRecord.selectNewLineItem('inventory');
_invadjtransRecord.setCurrentLineItemValue('inventory', 'item', _item);
_invadjtransRecord.setCurrentLineItemValue('inventory', 'location', _location);
_invadjtransRecord.setCurrentLineItemValue('inventory', 'adjustqtyby', _adjQuantity);
var inventoryDetail = _invadjtransRecord.createCurrentLineItemSubrecord('inventory','inventorydetail');
inventoryDetail.selectNewLineItem('inventoryassignment');
inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'expirationdate', _expDate);
inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'inventorystatus', 1);
inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'issueinventorynumber', _invNo);
inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', _adjQuantity);
inventoryDetail.commitLineItem('inventoryassignment');
inventoryDetail.commit();

3 个答案:

答案 0 :(得分:2)

要使用*Current*版本的子列表API,Record对象必须处于动态模式。有关如何指定标准或动态模式,请参见nlapiCreateRecord的参数。

答案 1 :(得分:0)

您添加的.commit()行项目是否缺少inventory

答案 2 :(得分:0)

非常感谢eng ericgrubaugh 的帮助 我搜索了动态和标准模式记录,它对我有所帮助。 在客户端使用此代码时发生了问题,但应该在服务器端 随着变化

var _invadjtransRecord = nlapiCreateRecord('inventoryadjustment');
to 
var inventoryDetail = _invadjtransRecord.createCurrentLineItemSubrecord('inventory', 'inventorydetail');

参考 SuiteScript Developer & Reference Guide pdf Suite Answers

非常感谢