suitescript 2.0:如何在客户端脚本中修改和保存子记录

时间:2018-12-18 02:24:33

标签: netsuite suitescript2.0

我正在尝试在客户端脚本中修改<video>并将其保存,但是在保存时,出现以下错误:

  

“无法读取未定义的属性'invalidateCurrentSublistLineForSubrecordCache'”

当前代码:

subrecord

我不确定/** * @NApiVersion 2.x * @NModuleScope public */ define(['N/record','N/currentRecord','N/search'], function(record,currentRecord,search) { return({ stock: function(context) { var curRec = currentRecord.get(); var ab_search = search.create({ type: search.Type.TRANSACTION, title: 'YXZC_Assembly_Build_Search', id: 'customsearch_yxzc_assembly_build_search', columns: ['internalid'], filters: [ ['createdfrom', 'is', curRec.id],'and',['type','is','Build'] ] }); ab_search.save(); var searchResult = ab_search.run().getRange({ start: 0, end: 1 })[0]; var internalid = searchResult.getValue(searchResult.columns[0]); search.delete({ id: 'customsearch_yxzc_assembly_build_search' }); var rec = record.load({ type: record.Type.ASSEMBLY_BUILD, id: internalid, // isDynamic: true, }); var inventorydetailRec = rec.getSubrecord({ fieldId: 'inventorydetail', }); var line = inventorydetailRec.getLineCount({ sublistId: 'inventoryassignment' }); for (var i=0; i<line; i++){ inventorydetailRec.setSublistValue({ sublistId:'inventoryassignment', fieldId: 'inventorystatus', line: i, value: '2' }); }; var recId = rec.save({ enableSourcing: true, ignoreMandatoryFields: true }); } }); }); 属性的含义。

任何人都知道为什么会发生此错误?

2 个答案:

答案 0 :(得分:1)

尝试record.submitFields()

请参见https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4267283788.html

由于我遇到了同样的问题,所以我偶然发现了你的问题,但是在@erictgrubaugh的帮助下找到了解决方案

答案 1 :(得分:0)

子记录对于客户端脚本是只读的。客户端脚本能够从父记录中删除子记录,但是不能对其进行修改。请参见支持子记录脚本的部署in the NetSuite help