This is the method to add a sublist to the custom form. This needs a module called N/ui/serverWidget. This return a serverWidget.Sublist object. It is supported in suitelet script type and user event script types (beforeload). The syntax is as follows:
var sublist = form.addSublist({
id: ‘custpage_id’,
type: serverWidget.SublistType.INLINEEDITOR,
label: ‘Inline editor Sublist’
});
In the syntax, the id, label and type are required. The id has certain condition: The internal ID must be in lowercase, contain no spaces, and include the prefix custpage if you are adding the sublist to an existing page. For example, if you add a sublist that appears as Purchase Details, the sublist internal ID should be something equivalent to custpage_purchasedetails or custpage_purchase_details.
There are different sublist types. They are:
INLINEEDITOR, EDITOR: These types of sublists are both fully editable. The only difference between these types is their appearance in the UI: With an inline editor sublist, a new line is displayed at the bottom of the list after existing lines. To add a line, a user working in the UI clicks inside the new line and adds a value to each column as appropriate. Examples of this style include the Item sublist on the sales order record and the Expense sublist on the expense report record. With an editor sublist, a user in the UI adds a new line by working with fields that are displayed above the existing sublist lines. This style is not common on standard NetSuite record types.
LIST: This type of sublist has a fixed number of lines. You can update an existing line, but you cannot add lines to it. Note: To make a field within a LIST type sublist editable, use Field.updateDisplayType(options) and the enum serverWidget.FieldDisplayType to update the field display type to ENTRY.
STATICLIST: This type of sublist is read-only. It cannot be edited in the UI, and it is not available for scripting.