【问题标题】:Suitescript - How to know the fields ID in sub record - Inventory transferSuitescript - 如何知道子记录中的字段 ID - 库存转移
【发布时间】:2018-03-13 21:17:52
【问题描述】:

我正在尝试创建一个可以创建 bin 转移的 restlet。 我的代码差不多完成了,我也可以创建订单项字段了。

我唯一不能做的是填写库存详细信息,因为我不知道子记录中的字段。如何检查子记录行项目列中的字段id?

define([ 'N/record', 'N/search'], function(r, s) {
function onSendRequst(context) 
{

    var rec = r.create({
        type: context.recordtype,
        isDynamic: true
    });

    rec.setValue( 'location', context.from_location_id );
    rec.setValue( 'transferlocation', context.to_location_id );
    rec.setValue( 'memo', context.memo );     

    for( var i = 0; i < context.inventory.length; i++)
    {
        var inv = context.inventory;

        // Create sublist Record
        rec.selectNewLine({
            sublistId: 'inventory',
            line: i+1
        });

        rec.setCurrentSublistValue({
            sublistId: 'inventory',
            fieldId: 'item',
            value: inv[i].item_ndc
        });
        rec.setCurrentSublistValue({
            sublistId: 'inventory',
            fieldId: 'adjustqtyby',
            value: inv[i].qty
        });

        rec.commitLine({
            sublistId: 'inventory'
        });


        // **CREATE A SUB RECORD**

        var itemInventorySubrecord = r.getSublistSubrecord({
            sublistId: 'item',
            fieldId: 'inventorydetail',
            line: x
        });
    }
    var recordId = rec.save({
        enableSourcing: true,
        ignoreMandatoryFields: true
    });
    return recordId;
}

return {
    post: onSendRequst
} 
});

【问题讨论】:

    标签: netsuite suitescript2.0


    【解决方案1】:

    您可以在记录浏览器的库存详细信息条目下找到库存详细信息的字段 ID。子记录在 SuiteScript 记录浏览器中可用,就像常规记录一样。

    【讨论】:

    • 对于主记录,它的 id 是 tranid 还是 externalid。还是其他身份证?那我如何找到记录的主键?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-04
    相关资源
    最近更新 更多