Form object method · N/ui/serverWidget

addField()

Form.addField(options)

Adds a field to the form.

Implementation
Not started
Design
Open for proposals suggest how it should read
Proposals
A
Signature
Form.addField(options)
Returns
serverWidget.Field
Governance
None
Script types
Suitelets and beforeLoad user events
Version
SuiteScript 2.x, documented for 2.1; since NetSuite 2015.2
call shapefrom Oracle's parameter table
1objForm.addField({2    id:        /* string, required */,3    label:     /* string, required */,4    type:      /* string, required */,5    source:    /* string, optional */,6    container: /* string, optional */7});
Oracle reference for this method
ParameterTypeRequiredDescription
options.idstringrequiredThe internal ID of the field. The internal ID must be in lowercase, contain no spaces, and include the prefix custpage if you are adding the field to an existing page. For example, if you add a field that appears as Purchase Details , the field internal ID should be something similar to custpage_purchasedetails or custpage_purchase_details .
options.labelstringrequiredThe label for this field.
options.typestringrequiredThe field type for the field. Use the serverWidget.FieldType enum to define the field type. Important: Long text fields created with SuiteScript have a character limit of 100,000. Long text fields created with Suitebuilder have a character limit of 1,000,000.
options.sourcestringoptionalThe internalId or scriptId of the source list or record type for this field if it is a select (List/Record) or multi-select field. Source list is a category containing standard lists and custom lists. Record types include standard record types like employee, sales order, and transaction, as well as custom record types. Examples of IDs include: standard record (salesorder, customer, employee); custom record (customrecord_car_model); standard list: (employeetype, ordertype); custom list (customlist_color). Important: After you create a select or multi-select field that is sourced from a record or list, you cannot add additional values with Field.addSelectOption(options) . The select values are determined by the source record or list. Note: For radio fields only, the source parameter must contain the internal ID for the field. For more information about working with radio buttons, see SuiteScript 1.0 Documentation .
options.containerstringoptionalThe internal ID of the tab or field group to add the field to. By default, the field is added to the main section of the form.
B

No Mynt syntax yet.

Nothing in the language compiles to Form.addField(options) today. How should it read?

C

Competing syntax for addField, from GitHub Discussions. Select two or more to compare them side by side.

All discussions

Loading proposals from GitHub…

D

Write the Mynt you wish you could write.

A good proposal shows the syntax, the SuiteScript it should become, and argues for it: why it is clearer, how it fits the rest of the language, what it makes harder.

  • Clarity. Does it say what happens, without ceremony?
  • Consistency. Does it read like load, save and Ref[field]?
  • Expressiveness. Does it cover the cases people actually write?
  • Honesty. Does it hide a NetSuite cost, such as governance, that a reader should see?

N/ui/serverWidget · Form.addField(options)

Suggest syntax for addField