【发布时间】:2017-02-18 00:45:50
【问题描述】:
我用套件构建了一个表单,它有一个子列表、下拉列表和一个按钮。在用户勾选子列表上的一些选择后,按下一个按钮,选定的项目将通过 rest 发送到其他地方。
套房:
@NApiVersion 2.x
*@NScriptType Suitelet
*/
define(['N/ui/serverWidget', 'N/search', 'N/https', 'N/record'],
function(serverWidget, search, https, record) {
function onRequest(context) {
if (context.request.method === 'GET') {
var form = serverWidget.createForm({ ... });
form.clientScriptModulePath = 'path/to/client/script';
// code to build a sublist, add a button and write page
} return {
onRequest: onRequest
};
});
然后,我的客户端脚本是这样的:
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(
[ 'N/currentRecord', 'N/https' ],
function(currentRecord, https) {
functionSendRequest(sublist //the sublist that I want to get from the suitelet)
{
//code to build json string and send http request
} return {
saveRecord: test
}
});
现在,在花费了几个小时之后,我注意到了一个 N/currentRecord(我不喜欢 netsuite),它似乎是我的问题解决者,因为它检索当前正在使用的记录在客户端上下文中活跃。它非常适合下拉菜单,并且有一个 getSublist(options) 方法,尽管它返回的 record.Sublist 只有 getColumn() 方法。因此,它对我来说真的不起作用。那么,一旦按下按钮,有没有办法将子列表参数从套件传递给客户端脚本?
【问题讨论】:
标签: netsuite suitescript