Netsuite itemfulfillment:子列表项字段inventorydetail不是子记录字段

Netsuite itemfulfillment:子列表项字段inventorydetail不是子记录字段,netsuite,Netsuite,我想在netsuite中执行binitemfulfillment 但我找不到一个有效的例子。当我运行以下代码时,我收到此错误: 子列表项目字段inventorydetail不是子记录字段 我需要知道创建itemfulfillment 谢谢 var sales_internalid = '2465'; //saleorderid var einternalid = '110'; //employeeid var winternalid = '1'; //washsouei

我想在netsuite中执行bin
itemfulfillment

但我找不到一个有效的例子。当我运行以下代码时,我收到此错误:

子列表项目字段inventorydetail不是子记录字段

我需要知道创建
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);

我第一次通过客户代码进行库存转移时也遇到了同样的问题。当“高级箱子管理”功能启用时,箱子编号字段只是一个子记录。如果您正在使用的帐户设置为仅“使用仓位”,则通过其文本值设置交易项目行上的仓位编号字段。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
            });

复习语法