我有一个套件,它调用一个子列表,但是当单击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 );}
您只查看“ 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
}