2015-09-11 72 views
0

我想執行bin傳輸。但我不能去一個有效的例子。 當我運行下面的代碼時,我收到了這個錯誤「Sublist inventory field inventorydetail is not subrecord field」。腳本bin傳輸錯誤

我需要知道什麼是正確的子記錄的名稱創建一個箱子轉移

感謝

var binTransfer = nlapiCreateRecord('bintransfer'); 
binTransfer.setFieldValue('subsidiary',4); 
binTransfer.setFieldValue('trandate','9/11/2015'); 
binTransfer.setFieldValue('location',18); 

var invDetail = binTransfer.createCurrentLineItemSubrecord('inventory', 'inventorydetail'); 
invDetail.selectNewLineItem('inventoryassignment'); 
invDetail.setCurrentLineItemValue('inventoryassignment', 'binnumber', 'ZB17A01'); 
invDetail.setCurrentLineItemValue('inventoryassignment', 'tobinnumber', 'OZ_RECEIVING_18'); 
invDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', 1); 
invDetail.commitLineItem('inventoryassignment'); 
invDetail.commit(); 

binTransfer.commitLineItem('inventory'); 

nlapiSubmitRecord(binTransfer); 

回答

1

這是正確的代碼做在NetSuite的

var binTransfer = nlapiCreateRecord('bintransfer'); 
binTransfer.setFieldValue('subsidiary',4); 
binTransfer.setFieldValue('trandate','9/11/2015'); 
binTransfer.setFieldValue('location',18); 

binTransfer.selectNewLineItem('inventory'); 
binTransfer.setCurrentLineItemValue('inventory', 'item',108939); 
binTransfer.setCurrentLineItemValue('inventory', 'frombins', 'ZB17A01'); 
binTransfer.setCurrentLineItemValue('inventory', 'tobins', 'OZ_RECEIVING_18'); 
binTransfer.setCurrentLineItemValue('inventory', 'quantity', 1); 
binTransfer.commitLineItem('inventory'); 

nlapiSubmitRecord(binTransfer); 
0

倉轉移「frombins」和「tobins」不正確。另外,我必須配置inventorydetail以使其工作。還有一點需要注意,腳本在某些(全部)客戶端腳本中不起作用:

 var obj = nlapiCreateRecord('bintransfer', {recordmode:'dynamic'}); 

     obj.setFieldValue('trandate', todaydate); 
     obj.setFieldValue('memo', 'PP#' + pplanid); 
     obj.setFieldValue('location', '55'); 


     for(i=0; i < (inputcount + 1); i++){ 
      var param_qtyinput = pnvl(request.getParameter('qtyinput' + i),true); 
      var param_binselect = request.getParameter('binselect' + i); 
      var param_itemid = request.getParameter('itemid' + i); 
      var param_frombinid = request.getParameter('frombinid' + i); 

      if(param_qtyinput > 0 && param_binselect != null){ 

       obj.selectNewLineItem('inventory'); 
       obj.setCurrentLineItemValue('inventory', 'item', param_itemid); 
       obj.setCurrentLineItemValue('inventory', 'quantity', param_qtyinput); 

       var subrecord = obj.createCurrentLineItemSubrecord('inventory', 'inventorydetail'); 

        subrecord.selectNewLineItem('inventoryassignment'); 

        subrecord.setCurrentLineItemValue('inventoryassignment', 'quantity', param_qtyinput); 
        subrecord.setCurrentLineItemValue('inventoryassignment', 'binnumber', param_frombinid); 
        subrecord.setCurrentLineItemValue('inventoryassignment', 'tobinnumber', param_binselect); 

        subrecord.commitLineItem('inventoryassignment'); 
        subrecord.commit(); 

       obj.commitLineItem('inventory'); 

      } 
     } 

     var id = nlapiSubmitRecord(obj);