2017-08-15 3 views
1

netsuiteにビンitemfulfillmentを入れたいと思います。itemfulfillment:サブリストアイテムフィールドinventorydetailはサブレコードフィールドではありません

しかし、私は動作する例を得ることができません。私は以下のコードを実行すると、私はこのエラーが発生します:

Sublist item field inventorydetail is not a subrecord field

私はitemfulfillment

感謝を作成するために、正しいサブレコードの名前が何であるかを知っておく必要があります!

var sales_internalid = '2465'; //saleorderid 
    var einternalid = '110'; //employeeid 
    var winternalid = '1'; //washsoueid 
    var sinternalid = '6'; //itemid 
    var quantity = 1; 
    var displayname ='iphone'; 
    var shipgroup = 1; 
    var salesOrder= nlapiCreateRecord('salesorder', sales_internalid, {recordmode: 'dynamic'}); 

    var obj = nlapiTransformRecord('salesorder', sales_internalid, 'itemfulfillment'); 
    obj.selectLineItem('item',1); 
    obj.setCurrentLineItemValue('item', 'item', sinternalid); 
    obj.setCurrentLineItemValue('item', 'location', winternalid); 
    obj.setCurrentLineItemValue('item', 'quantity', 1); 
    var subrecord= obj.editCurrentLineItemSubrecord('item', 'inventorydetail'); 
    subrecord.selectLineItem('inventoryassignment', 1); 
    subrecord.selectNewLineItem('inventoryassignment'); 
    subrecord.setCurrentLineItemValue('inventoryassignment', 'inventorynumber', '1'); 
    subrecord.setCurrentLineItemValue('inventoryassignment', 'quantity', '1'); 
    subrecord.commitLineItem('inventoryassignment'); 
    subrecord.commit(); 
    obj.commitLineItem('item'); 

    var fulfillmentOrderId = nlapiSubmitRecord(itemFulfillment, true); 
+0

シンタックスシンタックス – Fabien

答えて

1

クライアントのコード経由で最初の在庫転送を行うときに同じ問題が発生しました。 Bin Numberフィールドは、「Advanced Bin Management」機能が有効になっている場合にのみサブレコードになります。あなたが働いているアカウントが単に「箱を使用する」ように設定されている場合、トランザクションの行項目のBin Numberフィールドはテキスト値で設定されます。例はSS 2.0ですが、私はそれがポイントを越えていると信じています:

  newRec = nsRecord.create({ 
       type: nsRecord.Type.INVENTORY_ADJUSTMENT, 
       isDynamic: true 
      }); 

      // In dynamic mode must set the subsidiary first. 
      newRec.setValue({ 
       fieldId: bodyFields.subsidiary, 
       value: locSub[datain.Location] 
      }); 
      newRec.setValue({ 
       fieldId: bodyFields.adjustment_Location, 
       value: datain.Location 
      }); 
      newRec.setValue({ 
       fieldId: bodyFields.date, 
       value: date 
      }); 
      newRec.selectNewLine({ 
       sublistId: columnFields.type 
      }); 
      newRec.setCurrentSublistValue({ 
       sublistId: columnFields.type, 
       fieldId: columnFields.item, 
       value: datain.Item 
      }); 
      newRec.setCurrentSublistValue({ 
       sublistId: columnFields.type, 
       fieldId: columnFields.adjust_Qty, 
       value: datain.Quantity.toString() 
      }); 
      if (parseFloat(datain.Quantity) > 0) { // If qty is positive must set the Est Unit Cost. 
       itemVals = nsSearch.lookupFields({ 
        type: nsSearch.Type.ITEM, 
        id: datain.Item, 
        columns: fields 
       }); 
       cost = itemVals.averagecost || itemVals.lastpurchaseprice; 
       newRec.setCurrentSublistValue({ 
        sublistId: columnFields.type, 
        fieldId: columnFields.est_Unit_Cost, 
        value: cost 
       }); 
      } 
      // 
      // Format for binnumbers field is 'ValueText(qty)\rValueText(qty)\rValueText(qty) 
      // the only exception is in cases of negative qty 
      // 
      binText = datain.Bin ? datain.Bin + '(' + datain.Quantity + ')' : ''; 
      newRec.setCurrentSublistValue({ 
       sublistId: columnFields.type, 
       fieldId: columnFields.bin_Numbers, 
       value: binText 
      }); 
      newRec.commitLine({ 
       sublistId: columnFields.type 
      }); 
      invRecResult.invRecId = newRec.save({ 
       enableSourcing: true, 
       ignoreMandatoryFields: true 
      }); 
関連する問題