【问题标题】:Getting Sub lists from netsuite for Customers从 netsuite 为客户获取子列表
【发布时间】:2018-12-11 12:31:22
【问题描述】:

以下是客户使用currentRecord.getSublists();的子记录

我越来越喜欢["currency","creditcards","grouppricing","itempricing","systemnotes","access","activeworkflows","recmachcustrecord2","recmachcustrecord_2663_parent_cust_ref","subscriptions"]

用于recmachcustrecord2 子记录。我想存储到另一个变量中,例如

    var sublistFieldValue = currentRecord.getSubrecord({
        fieldId: 'recmachcustrecord2'
    });

但我越来越喜欢了

"type":"error.SuiteScriptError","name":"FIELD_1_IS_NOT_A_SUBRECORD_FIELD","message":"字段 custrecord_acceptable_min_shelf_life 不是子记录 field.","stack":["anonymous(N/serverRecordService)","onAfterSubmit(/SuiteScripts/cus.js:38)"],"cause":{"type":"internal 错误","代码":"FIELD_1_IS_NOT_A_SUBRECORD_FIELD","详细信息":"字段 custrecord_acceptable_min_shelf_life 不是子记录 字段。","userEvent":"aftersubmit","stackTrace":["anonymous(N/serverRecordService)","onAfterSubmit(/SuiteScripts/cus.js:38)"],"notifyOff":false},"id ":"","notifyOff":false,"userFacing":false}

提前致谢!

【问题讨论】:

    标签: netsuite suitescript


    【解决方案1】:

    currentRecord.getSublists() 用于获取当前记录上的子列表列表,子列表不是子记录。根据您的示例,您需要按如下方式使用 getSublist

    sublist = currentrecord.getSublist({ sublistId: 'recmachcustrecord2' });
    

    子列表表示记录,因此您可以直接从子列表本身编辑/读取数据。 要读取和编辑子列表中的字段,您可以使用以下内容

    // to read values from sublist
    currentrecord.getSublistValue({ sublistId: 'recmachcustrecord2', fieldId: SUBLIST_FIELD_ID, line: LINE# });
    // to edit values
    currentrecord.selectLine({ sublistId: 'recmachcustrecord2', fieldId: SUBLIST_FIELD_ID, line: LINE# });
    currentrecord.setCurrentSublistValue({ sublistId: 'recmachcustrecord2', fieldId: SUBLIST_FIELD_ID, line: LINE#, value: VALUE });
    currentrecord.commitLine({ sublistId: 'recmachcustrecord2' });
    

    【讨论】:

      【解决方案2】:

      您正在查看的是子列表,而不是子记录。您需要使用 currentRecord selectLinegetCurrentSublistValue 方法从子列表中检索值。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-03
        • 1970-01-01
        相关资源
        最近更新 更多