为了账号安全,请及时绑定邮箱和手机立即绑定

我需要事务字段的文本作为通过 portlet 构建的 NetSuite 保存搜索中的变量

我需要事务字段的文本作为通过 portlet 构建的 NetSuite 保存搜索中的变量

慕运维8079593 2021-07-01 10:07:12
我正在我的客户中心环境中添加一个自定义列表 portlet,该 portlet 使用一个自定义字段,该字段包含一个表示客户购买的所有项目的内部 ID 的值。此值将用作已保存搜索中的过滤器,其数据将填充列表 Portlet。该字段的文本看起来像“123”、“456”等。我可以通过调试器成功检索字段文本,但是当我将该字段的值作为变量传递给我的过滤器时,它会产生一条错误消息:Filter expecting numeric value was removed, as non-numeric value ... was provided.使用 NetSuite 搜索导出以非动态方式重新创建我正在寻找的内容,生成以下代码:var customrecord_vcc_documentsSearchObj = search.create({   type: "customrecord_vcc_documents",   filters:   [     [["custrecord_vcc_customer_docs","anyof","@CURRENT@"],"AND",["custrecord_vcc_doc_type","noneof","1"]],      "OR",       ["custrecord_vcc_doc_type","anyof","5"],      "OR",       [["custrecord_vcc_doc_type","anyof","2","3","4","6","7"],"AND",["custrecord_vcc_doc_item","anyof","2291","3546","2279","1976"]]   ],   columns:   [      search.createColumn({         name: "name",         sort: search.Sort.ASC,         label: "Name"      }),      search.createColumn({name: "custrecord_vcc_doc_type", label: "Type"}),      search.createColumn({         name: "formulatext",         formula: "'<a href='||{custrecord_vcc_link_to_file}||'>Open</a>'",         label: "Link"      })   ]});当我尝试替换时:["custrecord_vcc_doc_item","anyof","2291","3546","2279","1976"]
查看完整描述

2 回答

?
HUH函数

TA贡献1836条经验 获得超4个赞

如果我理解正确,您正在构建一个逗号分隔项的字符串数组:


[

    '"2191","2046","1209"',

    '"1209","1988","2092"',

    '"295","1214","1988"'

]

然后调用 toString 方法来创建:


'"2191","2046","1209","1209","1988","2092","295","1214","1988"'

并将该字符串传递给您的搜索过滤器:


["custrecord_vcc_doc_item","anyof",'"2191","2046","1209","1209","1988","2092","295","1214","1988"']

并且过滤器无法识别'"2191","2046","1209","1209","1988","2092","295","1214","1988"'为数字。


相反,您需要替换双引号并在逗号处拆分 itemarraytext 变量:


["custrecord_vcc_doc_item","anyof",itemarraytext.replace(/"/g,'').split(',')];

这应该相当于:


["custrecord_vcc_doc_item","anyof",["2191","2046","1209","1209","1988","2092","295","1214","1988"]]



查看完整回答
反对 回复 2021-07-08
  • 2 回答
  • 0 关注
  • 213 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信