繁体   English   中英

基于标题字段的SuiteScript 2.0返回行

[英]SuiteScript 2.0 return lines based on header fields

我最近开始了SuiteScript 2.0开发,并且坚持以下几点:

客户需要定制表格。 表单具有3个标题字段:

位置,周数和子公司。 根据他在这三个字段中输入的值,需要返回自定义记录的值。

因此,我已经建立了自定义表单,但仍停留在适当的功能上。 我想可以通过在三个标头记录中的值填写后从自定义按钮调用客户端脚本来做到这一点。 所以我的代码是:

/**
* @NApiVersion 2.x
* @NScriptType Suitelet
* @NModuleScope SameAccount
 */
 define(['N/record', 'N/redirect', 'N/ui/serverWidget'],
 /**
 * @param {record} record
 * @param {redirect} redirect
 * @param {serverWidget} serverWidget
  */
function(record, redirect, serverWidget) {

 /**
 * Definition of the Suitelet script trigger point.
 *
 * @param {Object} context
 * @param {ServerRequest} context.request - Encapsulation of the incoming request
 * @param {ServerResponse} context.response - Encapsulation of the Suitelet response
 * @Since 2015.2
 */

function onRequest(context) {
    var request  = context.request;
    var response = context.response;


    var form     = serverWidget.createForm({
        title : 'Planning',
        hideNevBar : false

    });

    var LocationGrp = form.addFieldGroup({
        id : 'custpage_grp_main',
        label : 'Location'
    });

    var PlanningGrp = form.addFieldGroup({
        id : 'custpage_grp_sub',
        label : 'Planning'
    });


    var locatieFld = form.addField({
        id : 'custpage_location',
        type: serverWidget.FieldType.SELECT,
        label : 'Location',
        source : 'location',
        container : 'custpage_grp_main'
    });

    var subsidiaryFld = form.addField({
        id : 'custpage_subsidiary',
        type: serverWidget.FieldType.SELECT,
        label : 'Subsidiary',
        source : 'subsidiary',
        container : 'custpage_grp_main'
    });

    var weekFld = form.addField({
        id : 'custpage_weeknr',
        type: serverWidget.FieldType.SELECT,
        label : 'Weeknumber',
        source : '500',
        container : 'custpage_grp_main'
    });


    var sublijst = form.addSublist({
        id : 'custpage_lines',
        type: serverWidget.SublistType.INLINEEDITOR,
        label : 'LINES'
    });


    var itemFld = sublijst.addField({
        id : 'custpage_item',
        type : serverWidget.FieldType.SELECT,
        source : 'item',
        label : 'Item'
    });



    // Buttons

    form.addButton({
        id: 'getval',
        label: 'Get lines',
        functionName: 'setButton'
    });
    form.clientScriptModulePath = './script.js';


    response.writePage(form);
}
    return {
            onRequest: onRequest
        };

});

但是,我不确定要在客户端脚本中使用什么代码来检索行上的“项目”。

包含所有项目行的自定义记录有四列:

位置,星期编号,子公司和项目。

谁可以提供帮助(我的问题是否连贯)?

好的,所以我通过另一条路线找到了答案。

我有2种形式,第一种有输入字段和一个按钮。 单击按钮后,将加载第二个表单,并将表单1的输入用作保存的搜索中过滤器的输入值。 然后将保存的搜索发布到第二个表单。

作品.....有点。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM