有很多关于如何处理netsuite子列表的教程或参考资料,但它们都不能满足我的需要。
我只需要通过客户端脚本更新/添加我在suitelet中创建的自定义子列表。这是我的行李箱代码
//this is a custom sublist
var sublist = form.addSubList('targetlist', 'list', null, 'target_list');
sublist.addField('industry', 'text', 'Industry');
sublist.addField('inp_name', 'text', 'Name');
在客户端脚本中,我只想在某些字段发生变化时添加一些行项目,例如
function targetListClient(type, name, lineNum) {
if(name == 'industry') {
nlapiSelectNewLineItem('targetlist');
nlapiSetCurrentLineItemValue('targetlist', 'industry', 'test');
nlapiSetCurrentLineItemValue('targetlist', 'inp_name', 'test again');
nlapiSetCurrentLineItemValue('targetlist', 'jobtitle', 'another test');
nlapiCommitLineItem('targetlist');
}
}
我认为这应该可以工作,但我得到了这个错误。Uncaught TypeError: Cannot read property 'checkvalid' of undefined
我还尝试只设置行项目nlapiSetLineItemValue('industry', 1, 'again')
,而不是选择当前行项目,但这也不起作用。
我实现的子列表概念是不正确的吗?谁能在这方面给我指点一下。谢谢。
发布于 2015-06-19 13:50:12
在函数targetListClient中,您为字段jobtitle提供了一个值,但是子列表创建代码只有行业和inp_name字段。
发布于 2015-06-20 09:17:10
你的代码也有form.setScript吗?你提到了一个客户端脚本。您需要使用form.setScript将客户端脚本附加到您的套件。
发布于 2015-07-13 12:25:46
尝试使用以下命令:
nlapiSetCurrentLineItemValue('targetlist', 'industry', 'test',false,true);
说明: nlapiSetCurrentLineItemValue具有firefieldchanged参数,默认情况下设置为true如果不将其设置为false,则会反复调用fieldChanged脚本,导致无限循环.So尝试将其设置为false .This应该可以解决此问题
https://stackoverflow.com/questions/30935355
复制