0

我最近开始了 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
        };

});

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

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

地点、周数、子公司和项目。

谁能提供帮助(我的问题有点连贯)?

4

1 回答 1

0

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

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

工作......有点。

于 2018-02-12T11:30:10.253 回答