Show a Loading Spinner with UI Blur During Long-Running Actions

When performing long-running actions in a NetSuite Suitelet or Client Script — such as generating files, calling APIs, or triggering downloads — it’s good practice to show a loading indicator and block the UI to avoid user interaction. Here’s a reusable snippet that creates a full-screen blur overlay and centered loading GIF (spinner). Why Use… Continue reading Show a Loading Spinner with UI Blur During Long-Running Actions

Suitelet script to trigger user event script

Suitelet script is used to trigger user event script. User Event script define([‘N/record’, ‘N/url’, ‘N/https’],     /**  * @param{record} record  */     (record, url, https) => {         /**          * Defines the function definition that is executed before record is loaded.          *… Continue reading Suitelet script to trigger user event script

Enhancing the Suitelet for Custom Reports

Suitelet to add more functionality and features to custom report: Export to CSV or Excel var csvContent = ‘Sales Order,Customer,Date,Total Amountn’; salesOrderSearch.run().each(function(result) {   csvContent += result.getValue(‘tranid’) + ‘,’ + result.getText(‘entity’) + ‘,’ + result.getValue(‘trandate’) + ‘,’ + result.getValue(‘total’) + ‘n’;   return true; }); context.response.setHeader({   name: ‘Content-Type’, value: ‘text/csv’ }); context.response.setHeader({   name: ‘Content-Disposition’, value: ‘attachment; filename=”sales_report.csv”‘… Continue reading Enhancing the Suitelet for Custom Reports

Setting field Help using SuiteScript in a Suitelet page

Create a form. let form = serverWidget.createForm({       title: ‘Sample Suitelet Page’       }); Add a field. let newField = form.addField({         id: ‘custpage_chechbox1’,          label: Check’,          type: serverWidget.FieldType.CHECKBOX, }); Script to add field help: newField.setHelpText({         help: “Provide the information you want to display in the field help, and it will be displayed when the user hover the field.”… Continue reading Setting field Help using SuiteScript in a Suitelet page

How to apply filters to the Suitelet page dynamically using Client Script

NetSuite’s Suitelets offer a powerful way to create custom pages, forms, and interfaces. One of the common tasks when working with Suitelets is to dynamically update a sublist based on user interaction or other factors. This can be accomplished by using a combination of SuiteScript 2.0 Suitelet and Client Script. Here’s a step-by-step guide on… Continue reading How to apply filters to the Suitelet page dynamically using Client Script

Code to Reset Suitelet Page (Cancel button).

Suitelet Script: form.addButton({                 id: ‘custpage_cancel_button’,                 label: ‘Cancel’,                 functionName: ‘cancel’             }); Client Script:  function cancel() {         history.back();     }

Multiple Columns in Suitelet Pages Using FieldBreakType and FieldLayoutType

FieldBreakType is a property that controls how fields are aligned relative to each other horizontally. It determines whether a field should start a new column, continue in the same column, or end the current column. This property is especially useful when you want to create multi-column layouts in your forms. FieldLayoutType is a property that… Continue reading Multiple Columns in Suitelet Pages Using FieldBreakType and FieldLayoutType

“Proper Initialization of Suitelet Select Fields to Avoid ‘addSelectOption is not a function’ Error”

When creating a custom form in Suitelet and attempting to add a selection field, you might encounter the error “addSelectOption is not a function” if you include the isMandatory attribute directly in the field creation object, as shown in the code snippet below: let gen = form.addField({   id: ‘custpage_gender’,   type: serverWidget.FieldType.SELECT,   label: ‘Gender’,   container: ‘custpage_primary’… Continue reading “Proper Initialization of Suitelet Select Fields to Avoid ‘addSelectOption is not a function’ Error”

Add Parameters to Script Record and Get Parameter Value in Suitelet Script

Open the script record where we want to add parameter, click “New Parameter” button in parameter subtab and add the parameter. Using script get the current script and then get the parameter. For example: let myScript = runtime.getCurrentScript(); let businessDaysCount = myScript.getParameter({           name: ‘<field_Id>’         }); The parameter value will be assigned to the variable, and… Continue reading Add Parameters to Script Record and Get Parameter Value in Suitelet Script

Execute Map/Reduce using Suitelet Script

Create task record in suitelet to pass the required parameters to map/reduce script, var mapReduceTask = task.create({                     taskType: task.TaskType.MAP_REDUCE,                     scriptId: BULK_SCHEDULER_OBJECT.scriptId,                     deploymentId: BULK_SCHEDULER_OBJECT.deploymentId,                     params: {                       “custscript_dynamicdate”: JSON.stringify(dynamicDate)                     }                   });                   var taskID = mapReduceTask.submit(); After collecting all the information from map/reduce script send the parameters to suitelet script, let requesturl = ExternalURL + ‘&apiType=bulkcreation&fundnumber=’ + fundNum… Continue reading Execute Map/Reduce using Suitelet Script