Aria Ghahari
02/13/2020, 2:12 PMvar cTranId = nlapiGetRecordId();
var filters = new Array();
filters[0] = new nlobjSearchFilter('internalid', null, 'anyof', cTranId); //internal id of the transaction record
var columns = new Array();
columns[0] = new nlobjSearchColumn('item');
var b = new Array();
var ss = nlapiSearchRecord('transaction', null, filters, columns);
for (a = 0; a < ss.length; a++) {
var item1 = ss[a].getValue(columns[0]);
if (item1 == 115) { //115 was the internalid of a sample discount item
nlapiSetLineItemValue('item', 'custcol_applied', a, ss[a - 1].getText(columns[0]));
}
}
Eric B
02/13/2020, 2:31 PMAria Ghahari
02/13/2020, 2:33 PMNElliott
02/13/2020, 2:58 PMAria Ghahari
02/13/2020, 2:59 PMNElliott
02/13/2020, 3:03 PMEric B
02/13/2020, 3:30 PMAria Ghahari
02/13/2020, 3:44 PM