朋友们正在使用 NetSuite 和 SuiteScript。我可以保存运行脚本的采购订单并收取创建的采购订单,但是当我将返回数据项值作为空值时,我需要获取该项目的 id。
结果给我的日志 NetSuite 是:
采购订单 ID:3706 供应商 ID:144 项目 ID:null Trandate:06/08/2015 表格:标准采购订单 货币:比索 CL
这会发生在所有采购订单中,很明显,如果您附有物品。
加载javascript以使用采购订单的函数如下:
function loadPurchaseOrder(){
nlapiLogExecution('DEBUG','loadPurchaseOrder', 'Entra a funcion loadPurchaseOrder');
//se aplican filtros para la busqueda del objeto
var filters= new Array();
filters[0] = new nlobjSearchFilter('purchaseorder',null,'isnotempty');
filters[1] = new nlobjSearchFilter('mainline', null, 'is', 'T');
//seleccion de los campos que se quieren extraer
var columns = new Array();
columns[0] = new nlobjSearchColumn('item');
columns[1] = new nlobjSearchColumn('entity');
columns[2] = new nlobjSearchColumn('trandate');
columns[3] = new nlobjSearchColumn('customform');
columns[4] = new nlobjSearchColumn('currency');
columns[5] = new nlobjSearchColumn('internalid');
var results = nlapiSearchRecord('purchaseorder',null,filters,columns);
var out = "";
if(results != null ){
for(var i=0; i< results.length; i++){
var purchaseOrder = results[i];
var idItem = purchaseOrder.getValue('item');
var idVendor = purchaseOrder.getValue('entity');
var trandate = purchaseOrder.getValue('trandate');
var form = purchaseOrder.getText('customform');
var currency = purchaseOrder.getText('currency');
var idPurchaseOrder = purchaseOrder.getText('internalid');
out = " ID Purchase Order: " + idPurchaseOrder + " ID Vendor: " + idVendor + " ID Item: " + idItem
+ " Trandate: " + trandate + " Form: " + form + " Currency: " + currency;
nlapiLogExecution('DEBUG','purchaseOrderCargada', out);
}
}
return out;
}
如果有人可以请帮助我。问候!
PD:
我也试过:
var idItem = nlapiGetLineItemField ('item', 'item');
它不起作用= /