我有一个Suitelet调用一个子列表,但是我想在单击“ addButton”时触发过滤器。
套房:
var form = serverWidget.createForm({ title : 'Unbilled Orders', hideNavBar : false });
form.addField({id: 'name_criteria', label: 'Name', type: serverWidget.FieldType.MULTISELECT, source: 'customer'});
form.addButton({label: 'Filter',id: 'custpage_mybutton',functionName: 'myButtonFunction()'});
var name_field = context.request.parameters.name_criteria;
//# Filter does not work as name_field='' #
var objSublistSearch = search.load({ id: SEARCH_ID });
var filterArray = objSublistSearch.filters;
filterArray.push(search.createFilter({ name: 'entity', operator: search.Operator.ANYOF, values: name_field }));
objSublistSearch.filters = filterArray;
var SublistSearch = objSublistSearch.run();
...
context.response.writePage(form);
客户端脚本(不更新子列表):
function myButtonFunction() {
// Load current record in order to manipulate it
var objRecord = currentRecord.get()
var field2 = objRecord.getValue({
fieldId: 'name_criteria',
});
log.debug("field2",field2 );}
答案 0 :(得分:0)
您只查看“ body”字段,而不是子列表。
尝试在客户端脚本中使用子列表功能。
var lines = objRecord.getLineCount({sublistId:'custpage_sublistid'});
for (line = 0; line < lines; line++) {
objRecord.selectLine({sublistId:'custpage_sublistid', line:line });
var existingValue = objRecord.getSublistValue({sublistId:'custpage_sublistid', fieldId:'custpage_columnid', line: line });
objRecord.setCurrentSublistValue({sublistId:'custpage_sublistid', fieldId:'custpage_columnid', value: 12345 });
// do other stuff
}
答案 1 :(得分:0)
您可以使用currentRecord的insertLine和removeLine方法更新子列表,但是请注意,它们仅适用于可编辑子列表(INLINEEDITOR和EDITOR)。
如果使用SublistType.LIST,则必须在myButtonFunction()中重新加载套件。