getOrderSublist()
The getOrderSublist() function (client-side) retrieves field values from a sublist belonging to the transaction page from which users open the product. The transaction must be available for NetSuite CPQ Configurator. For more information about compatible transactions, see Selecting Eligible Transactions.
Syntax
This is the general syntax for the getOrderSublist() function:
getOrderSublist(sublistId, columns);
See detailed information about the syntax for each parameter:
getOrderSublist('sublistId', ['fieldId1', 'fieldId2', 'fieldIDn']);
Return Value
The getOrderSublist() function returns an array of objects. Each object contains key-value pairs representing the requested fields for a line in the sublist.
Parameters
All parameters are required.
The getOrderSublist() function accepts the following parameters:
-
sublistId- The ID of the sublist you want to query in string format. For example,itemorshipgroup. -
columns- An array of field IDs to retrieve from the specified sublist.Results for dropdown lists, multi-select fields, and image fields return the internal ID of the selected option or image. To get the selected option label or the image relative URL in the File Cabinet, add the
:textsuffix to the field ID.
Examples
The following examples show how to use the getOrderSublist() function.
Retrieving Item/Name Number and Description Fields
In this example, the getOrderSublist() function retrieves the description and the internal ID from the Items sublist.
getOrderSublist('item', ['description', 'item']);
The example returns an array in which each object represents a line item with fields for the description and the item internal ID. The resulting output may look like this:
[
{
"item": "506",
"rate": "550.00"
},
{
"item": "502",
"rate": "175.00"
}
]
Retrieving Shipping Information
This example retrieves shipping method information from the shipgroup sublist.
getOrderSublist('shipgroup', ['shippingmethod']);
The resulting output may look like this:
[
{
"shippingmethod": "Pick-up at store"
}
]