Sunday, April 21, 2019

Get Purchase Order records related to the Bill record via scripting

On the Vendor Bill record, create a user-event script and use the sample code below:

function getPOnum()

var POnum;
var countLine = nlapiGetLineItemCount('purchaseorders');

for (var i = 1; i <= countLine; i++)
   var poid = nlapiGetLineItemValue('purchaseorders', 'id', i);
   var porec = nlapiLoadRecord('purchaseorder', poid);
   var podate = porec.getFieldValue('trandate');
   var ponum = porec.getFieldValue('tranid');
   var poamount = porec.getFieldValue('total');
   nlapiLogExecution('DEBUG', 'PO Date', podate);
   nlapiLogExecution('DEBUG', 'PO Number', ponum);
   nlapiLogExecution('DEBUG', 'PO Amount', poamount);


No comments:

Post a Comment