Mohamed Samir
Mohamed Samir

Reputation: 1

NetSuite : TypeError record.createCurrentLineItemSubrecord is not a function?

I'm getting

"TypeError _invadjtransRecord.createiewCurrentLineItemSubrecord is not a function"

When trying the below code:

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();

Upvotes: -2

Views: 1132

Answers (3)

Mohamed Samir
Mohamed Samir

Reputation: 1

I would thank you eng ericgrubaugh for your help i searched for Dynamic and Standard modes record and it helped me. the problem happened when using this code in client side but it should be in server side with change

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

references SuiteScript Developer & Reference Guide pdf Suite Answers

Thanks a lot

Upvotes: 0

Coldstar
Coldstar

Reputation: 1341

Is there a missing .commit() for the inventory lineitems you added?

Upvotes: 0

erictgrubaugh
erictgrubaugh

Reputation: 8857

To use the *Current* version of the sublist APIs, the Record object needs to be in Dynamic mode. See the parameters of nlapiCreateRecord for how to specify Standard or Dynamic modes.

Upvotes: 3

Related Questions