ANS-0276 · SUITESCRIPT DEVELOPMENT

How to Open and Pre-Populate a NetSuite Form Using URL Parameters

Learn how to programmatically open new NetSuite record forms and automatically populate fields using URL parameters and client-side scripting.

Short answer

To open and pre-populate a NetSuite form, use Window.open() to launch the new form. Construct the URL using SuiteScript 2.x N/url module methods, passing values as GET parameters in the format record.fieldName=value. For fields not automatically populated, implement a pageInit client-side script to set values programmatically.

Scenario

Users often need to streamline data entry by opening new NetSuite record forms with certain fields already filled in. This eliminates manual input for common values, improving efficiency and reducing errors when creating new records from a custom button or link.

Solution

  1. To open a new form, utilize the Window.open() method.

  2. To construct the URL for the new form, leverage methods within the N/url module in SuiteScript 2.x, such as url.resolveRecord(), url.resolveScript(), or url.resolveTaskLink().

  3. Pass the required values as GET parameters in the URL. For pre-populating standard body or header fields, use NetSuite's specific pattern: record.fieldName=value.

  4. NetSuite may automatically populate some fields when values are passed in this manner.

  5. If automatic population does not occur for specific fields, a pageInit client-side script can be implemented to programmatically set the field values.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant