【发布时间】:2019-02-11 05:02:35
【问题描述】:
我是 SuiteScript 的新手,我似乎无法完全理解在重定向中添加 url 参数。我知道SuiteScript 1.0的文档说明可以根据这个函数添加额外的参数:
sendRedirect(类型、标识符、id、编辑模式、参数)
type {string} [required] - The base type for this resource
identifier {string} [required] - The primary id for this resource (record type ID for RECORD, scriptId for SUITELET, taskId for tasklink, url for EXTERNAL)
id {string} [optional] - The secondary id for this resource (record type ID for RECORD, deploymentId for SUITELET)
editmode {boolean true || false} [optional] - For RECORD calls, this determines whether to return a URL for the record in edit mode or view mode. If set to true, returns the URL to an existing record in edit mode, otherwise the record is returned in view mode.
parameters {hashtable} [optional] - An associative array of additional URL parameters as name/value pairs
但我真的对最后一个第四个参数感到困惑,文档指出需要关联数组。我已经尝试编写此代码来测试添加该参数。
function suitelet(request, response) {
var arrayParam = [];
arrayParam.push({custparam_key: 'value'});
response.sendRedirect('SUITELET', 'customscript_a', 'customdeploy_a',
arrayParam);
}
但我无法找到最后一个参数在我的 Suitelet 中的位置。上面的代码确实允许用户使用其他默认参数重定向回相同的表单本身。但我不想要相同的默认参数。我希望能够在需要重定向用户的某些条件下制作额外的自定义参数。
我希望这一切都说得通。我觉得也许我不明白最后一个参数的用途。如果是这种情况,那么任何澄清都会有所帮助!
【问题讨论】:
-
您是否尝试将简单的 JSON 对象作为参数传递给 sendRedirect(即键值对,例如:
{ a: 'aa', b: 'bb' })? -
我有,但是在重定向表单后我无法捕获该参数。我猜也许它确实有效。也许我只是不知道该参数在 GET 和 POST 方法的上下文中的位置。
标签: javascript url redirect netsuite suitescript