如何在Suitelet上根据选择的筛选条件发布数据?

huangapple go评论78阅读模式
英文:

How to post data depending on selected filters on suitelet?

问题

我已在suitelet上创建了筛选字段。在筛选中,我选择选项,然后重定向到第二个suitelet。筛选字段包括,子公司、位置、年份和员工职务是'developer'。现在我想根据筛选中选择的选项和员工的职务是'developer'来发布数据到第二个suitelet。

我已将选择的筛选数据存储在变量中,如下所示:

var 子公司
var 位置
var 带有职务'developer'的员工

现在我想发布数据,即根据所选筛选条件匹配的员工数量。如何将这些数据发布到第二个suitelet?请帮忙!我将非常感激您的帮助。

英文:

I have created filter fields on suitelet. In filters I select options and then redirect to second suitelet. Filter fields are, subsidiary, location, year and employee designation is 'developer. Now I want to post data depending on option selected in filter and employee's designation is 'developer' to second suitelet.

I have stored selected filters data in variables as,

var subsidiary
var location
var employees with designation as 'developer

Now I want to post data like, no. of employees which matches depending on selected filters. How to post that data to second suitelet? Please help! I will appreciate your help.

答案1

得分: 0

这是用于调用 Suitelet 并将变量传递给它的代码示例,以及如何在 Suitelet 中接收它。还可以使用 N/redirect 模块将当前 Suitelet 重定向到被调用的(第二个)Suitelet。

// 在你的第一个 Suitelet 中调用这个代码并传递你的变量。
var suiteUrl = url.resolveScript({
     scriptId: 'customscript_workorder_multiple_print_sl',
     deploymentId: 'customdeploy_workorder_multiple_print_sl',
     params: {
         "subsidiary_data": subsidiary,   // 左边是唯一名称,右边是变量。
         "location_data": location,
         "employee_data": employee,
        },
     returnExternalURL: true
    });
redirect.redirect({ url: suiteUrl}); // 使用此代码将重定向到新的 Suitelet

// 然后在你已经调用的第二个 Suitelet 中接收它,就像这样
var subsidiary = scriptContext.request.parameters.subsidiary_data;  // 用唯一名称接收它,这里是 "subsidiary_data"
var location = scriptContext.request.parameters.location_data;
var employee = scriptContext.request.parameters.employee_data;

注意:这段代码是用于在 NetSuite 中调用 Suitelet 和传递参数的示例。如果需要更多的上下文或解释,请告诉我。

英文:

Here is the code sample for calling the suitelet and passing the variable to it. Also how to receive it the suitelet.Use N/redirect module as well for redirecting the current suitelet to called(second) suitelet.

//call this in your first suitelet and pass your variables.
var suiteUrl = url.resolveScript({
         scriptId: 'customscript_workorder_multiple_print_sl',
         deploymentId: 'customdeploy_workorder_multiple_print_sl',
         params: {
             "subsidiary_data": subsidiary,   // left one is unique name and right one is variable.
             "loaction_data": location,
             "employee_data": employee,
            },
         returnExternalURL: true
        });
      redirect.redirect({ url: suiteUrl}); // use this to redirect to the new suitelet
//Then receive it in your second suitelet that you have called like this

var subsidiary=scriptContext.request.parameters.subsidiary_data;  // for recieving it use unique name as here "subsidiary_data"
var location=scriptContext.request.parameters.loaction_data;
var employee=scriptContext.request.parameters.employee_data;

huangapple
  • 本文由 发表于 2023年2月27日 00:08:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75573268.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定