Discussions
Help with script
Hi,
Can anyone tell me what I am doing wrong with the following script:
var newRecord = nlapiGetNewRecord();
var filters = new Array();
for ( i = 1 ; i <= newRecord.getLineItemCount('item'); i++ ) {
var itemID = newRecord.getLineItemValue('item','item',i);
filters[0] = new nlobjSearchFilter('internalid',null,'equalTo',itemID,null);
var columns = new Array();
columns[0] = new nlobjSearchColumn('displayname');
columns[1] = new nlobjSearchColumn('featureddescription');
var searchresults = nlapiSearchRecord('inventoryitem',null,filters,columns);
var item_name = searchresults[0].getValue('displayname');
var description = searchresults[0].getValue('featureddescription');
var itemRecord = nlapiLoadRecord('inventoryitem',itemID);
nlapiLogExecutionNote('DEBUG','itemID='+itemID);
nlapiLogExecutionNote('DEBUG','itemRecord='+itemRecord);
nlapiLogExecutionNote('DEBUG','itemName='+item_name);
nlapiLogExecutionNote('DEBUG','description='+description);