【问题标题】:How to add inventory detalis to Assembly Build with suitescript 2.0?如何使用suitescript 2.0 将库存细节添加到Assembly Build?
【发布时间】:2021-05-19 08:11:08
【问题描述】:

我有一个处理 CSV 文件并将他导入 Netsuite 的过程。 它是一个带有装配 ID、批号、日期和数量的 JSON 对象。

lotData 是要插入的一行:{"assembly":"45","Lot Number":"2021 109 M 21 - 1","Expiry date":"12/05/2023","Quantity":"682"}

function createInvDet(lotData) {
    try {
        var assemblyLotNum;
        
        for (var field in lotData) {

            if (field == 'assembly') {
                lotData[field] = getAssemblyId(lotData[field]) // getting the assembly build id

                assemblyLotNum = context.record.load({
                    type: record.Type.LOT_NUMBERED_ASSEMBLY_ITEM,
                    id: lotData[field],
                });
                
            }


        }
    } catch (error) {

    }

如何获取库存详细信息子记录并在其中设置值?

【问题讨论】:

    标签: netsuite suitescript2.0


    【解决方案1】:

    假设这是在 SuiteSCript 2.x 中并且您已经加载了“N/record”模块,请更改

    assemblyLotNum = context.record.load({
       type: record.Type.LOT_NUMBERED_ASSEMBLY_ITEM,
       id: lotData[field],
    });
    

    到:

    assemblyLotNum = record.load({
       type: record.Type.LOT_NUMBERED_ASSEMBLY_ITEM,
       id: lotData[field],
    });
    

    不需要“上下文”。在“record.load”之前

    【讨论】:

    • 好的,我仍然如何将数据插入到库存详细信息中?
    • 更新装配项目记录?加载后(使用record.load),使用record.setValue 或record.setSublistValue。我不明确熟悉该记录的字段/设置,但可以在此处引用记录模块中的“.set”方法:netsuite.custhelp.com/app/answers/detail/a_id/45152/kw/…
    猜你喜欢
    • 1970-01-01
    • 2020-05-05
    • 1970-01-01
    • 2015-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-29
    • 2018-05-14
    相关资源
    最近更新 更多