Custom Child Record Sublist IDs Overview
Unlike other sublists, there are no standard IDs that can be documented for custom child record sublists. The internal ID for the sublist itself, and all of its associated fields, is unique to each custom child record sublist.
See these topics for guidelines on determining which IDs to reference in N/record Module or N/currentRecord Module:
Determining the Sublist ID
The internal ID for a custom child record sublist is recmach +field_id_for_the_parent_field (for example: recmachcustrecord102).
Use Record.getSublistValue(options) or CurrentRecord.getSublistValue(options).
// Add code.
...
var sublistFieldValue = objRecord.getSublistValue({ sublistId: 'item', fieldId: 'item', line: 3
});
...
// Add code.
Finding the Internal ID of a Custom Child Record Sublist
The following steps describe where to look in NetSuite to get the internal ID of a custom child record sublist.
To get the internal ID of a custom child record sublist (the field ID for the parent record):
-
Go to the record definition for the custom record type. For example, Fixed Assets, as shown in the following screenshot.
-
On the Fields subtab, notice that the ID column lists a List/Record field type.
The New Customer field (internal ID: custrecord102) is the parent field for the fixed assets records that appear as children on customer records. Therefore, the internal ID for the custom child Fixed Assets sublist on customer records is recmachcustrecord102.
Obtaining the Internal ID of the Parent Field
The following is an alternative approach for obtaining the internal ID of the parent field.
To obtain the internal ID of the parent field:
-
On the custom child record sublist, click the New child record button. In the following example, the button is New Fixed Assets.
-
When the new child record opens, notice the field that ties the child record to the parent record.
In this case, the New Customer field shows that the customer record for Abe Simpson is the parent of the fixed assets record. The field level help popup window for New Customer lists the field's internal ID as custrecord102. Therefore, the internal ID for the Fixed Assets sublist appearing on the (parent) customer record is recmachcustrecord102.
Internal IDs for custom child record sublists also appear in the SuiteScript Debugger when you load the record that includes the sublist.
Determining Field IDs
Use these steps to get internal field IDs on a custom child record sublist:
-
Go to the custom record definition page (for example, go to Customization > Lists, Records, & Fields > Record Types and select your custom record in the Record Types list).
-
On the Fields subtab of the Custom Record Type page, all field internal IDs appear in the ID column. These are the IDs you reference as the
fieldId
value in Record.getSublistValue(options) or CurrentRecord.getSublistValue(options).Example:
//Get the value of the Cost field on the first line (see the following figure) ... var sublistFieldValue = objRecord.getSublistValue({ sublistId: 'irecmachcustrecord102', fieldId: 'custrecord1', line: 1 });
You can get or set values for fields that appear in the Fixed Assets sublist. You can also set or get values that exist on the record, but do not appear in the sublist UI.
For example, the following line sets the value of the Salvage Value field in the fixed assets record 14 (see the following screenshot). The internal ID for Salvage Value is custrecord2. See this value on the Custom Record Type definition page for the fixed assets record type.
objRecord.setCurrentSublistValue({ sublistId: 'recmachcustrecord102', fieldId: 'custrecord2', });