ANS-1700 · CUSTOM FIELDS, RECORDS & FORMS
How to Customize NetSuite Forms Displayed in Site Builder?
Learn how to modify NetSuite forms specifically when they are rendered within your Site Builder web store using SuiteScript.
Short answer
To customize NetSuite forms appearing in Site Builder, implement a User Event Script with a 'before load' entry point. Within the script, check the execution context using `runtime.executionContext` from the `N/runtime` module. Ensure the script only executes when the context is `runtime.ContextType.WEBSTORE` to target web forms exclusively.
Scenario
Organizations often need to present customized forms to customers interacting with their NetSuite Site Builder web store. Standard form customizations may apply globally, but specific modifications are sometimes required only when a form is accessed via the website, not through the NetSuite UI. This requires a method to conditionally apply script logic based on the form's display context.
Solution
To customize forms displayed in NetSuite Site Builder, implement a User Event Script with a 'before load' entry point. Within this script, you must verify the execution context to ensure that form modifications are applied only when the form is rendered in the web store.
Create a User Event Script in NetSuite.
Set the script's entry point to
beforeLoad.Inside the
beforeLoadfunction, use theN/runtimemodule to check the current execution context. The script should proceed with form modifications only if the context matchesruntime.ContextType.WEBSTORE.
javascript/** * @NApiVersion 2.x * @NScriptType UserEventScript */define(['N/runtime'], function(runtime) { function beforeLoad(context) { if (runtime.executionContext === runtime.ContextType.WEBSTORE) { // Place your specific form customization logic here. // For example, to hide a field or change a label. } } return { beforeLoad: beforeLoad };});This conditional logic ensures that your script's changes are isolated to the web store experience, preventing unintended alterations to forms accessed through the NetSuite user interface.
Expert NetSuite Support
Need help with this NetSuite issue?
Custom Fields, Records & Forms consulting and configuration support
