ANS-0712 · SUITESCRIPT DEVELOPMENT

How to Create a Custom Select Field for Lead Sources in NetSuite SuiteScript

Implement a custom select field to display lead sources on NetSuite forms via SuiteScript.

Short answer

To create a custom select field for lead sources, use `form.addField('custpage_leadsource', 'select', 'Lead Source', 'campaign');` in SuiteScript. This method accurately replicates the standard NetSuite Lead Source field, allowing users to select from available campaign-driven lead sources directly on custom forms like estimates or sales orders.

Scenario

NetSuite users often require custom fields on forms to capture specific data. When the need arises to display a list of available lead sources as selectable options within a custom form, a direct approach using SuiteScript is necessary. The goal is to replicate the functionality of the standard Lead Source field found on core transaction records.

Solution

When attempting to create a custom select field to display lead sources, an initial approach might involve using leadsource as the source ID. However, this may not populate the complete list of available lead sources.

nform.addField('custpage_leadsource', 'select', 'Lead Source', 'leadsource');n

To accurately replicate the standard NetSuite Lead Source field, which often draws from marketing campaign data, the correct source ID to use is campaign. This ensures the custom field displays all relevant lead sources.

nform.addField('custpage_leadsource', 'select', 'Lead Source', 'campaign');n

This corrected implementation will populate the custom select field with the same lead source options seen on standard NetSuite records like estimates and sales orders.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant