Kristopher Wood
12/05/2025, 7:28 PMDerek Jackson
12/05/2025, 7:43 PMform.clientScriptModulePath = './pathToScript/script.js
then the button, which also is being created in the suitelet just calls a function, which i'm exporting via the client script:
form.addButton({
'id': 'custpage_filter_results',
'label': 'Filter Search Results',
'functionName': 'handleSearch'
});
then in my handleSearch() function in the client script i'm performing the actual logic of packing up whatever data i need from the filtered input and reloading the page with them:
//set up URL parameters to pass to search on reload
let params = new URLSearchParams(window.location.search);
// Update or add parameters
params.set('custpage_xxxxxx', rec.getValue({ fieldId: 'custpage_vendor_filter' }) || '');
params.set('custpage_xxxxx', rec.getValue({ fieldId: 'custpage_trandate_filter' }) || '');
params.set('custpagexxxxx', rec.getValue({ fieldId: 'custpage_date_range_start_filter' }) || '');
params.set('custpage_xxx', rec.getValue({ fieldId: 'custpage_date_range_end_filter' }) || '');
params.set('custpage_xxxx', rec.getValue({ fieldId: 'custpage_subsidiary_filter' }) || '');
// Build new URL and reload
let url = window.location.pathname + '?' + params.toString();
window.location.href = url;
then finally back in the suitelet, on GET i'm getting those, pushing to search filters as needed (maybe not applicable for your ask, i don't know) and setting the suitelet field values:
let dateRangeStart = params.custpage_date_range_start_filter;
let dateRangeEnd = params.custpage_date_range_end_filter;
if (dateRangeStart && dateRangeEnd) {
filter.push('AND', ['trandate', 'within', formatDate(dateRangeStart), formatDate(dateRangeEnd)]);
}
if (dateRangeStart) form.getField({ id: 'custpage_date_range_start_filter' }).defaultValue = formatDate(dateRangeStart);
if (dateRangeEnd) form.getField({ id: 'custpage_date_range_end_filter' }).defaultValue = formatDate(dateRangeEnd);
that's maybe a little convoluted but it worked for my client's needs. definitely a learning experienceKristopher Wood
12/05/2025, 7:58 PMKristopher Wood
12/05/2025, 8:23 PMAnthony OConnor
12/05/2025, 8:46 PMbattk
12/05/2025, 8:51 PMKristopher Wood
12/05/2025, 9:08 PMKristopher Wood
12/05/2025, 9:09 PMvar suiteletUrl = url.resolveScript({
scriptId: 'customscript_mvn_inventorycount_sl',
deploymentId: 1,
params: params
});
window.location.href = suiteletUrl;battk
12/05/2025, 9:14 PMKristopher Wood
12/05/2025, 9:15 PMKristopher Wood
12/05/2025, 9:15 PMKristopher Wood
12/05/2025, 9:16 PMKristopher Wood
12/05/2025, 9:16 PMbattk
12/05/2025, 9:17 PMbattk
12/05/2025, 9:18 PMKristopher Wood
12/05/2025, 9:19 PMKristopher Wood
12/05/2025, 9:19 PMKristopher Wood
12/05/2025, 9:44 PMyou should probably add a step on the form creation process in the GET to set a default value in the field for the filter you're applying from the param value.
This is exactly what I'm doing
const filterItemFld = form.addField({
id: 'custpage_filter_item',
type: serverWidget.FieldType.TEXT,
label: 'Item Number',
container: grpFiltersId
});
filterItemFld.defaultValue = params.custpage_filter_item || '';
And then later on in the sublist section
// Item
if (params['custpage_filter_item']) {
filters.push('AND');
filters.push(['item', 'is', params['custpage_filter_item']]);
}Anthony OConnor
12/05/2025, 9:45 PMKristopher Wood
12/05/2025, 9:45 PMKristopher Wood
12/05/2025, 9:46 PMDerek Jackson
12/05/2025, 9:46 PMAnthony OConnor
12/05/2025, 9:48 PM