[英]Module for replacing data in read-only fields in 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.