getOrderItems()

The getOrderItems() function (client-side) retrieves line field values for the Items sublist of 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

Use this syntax for the getOrderItems() function:

            getOrderItems(['fieldID1', 'fieldID2', 'fieldIDn']); 

          

Return Value

The getOrderItems() function returns an array of objects. Each object corresponds to a line item on the transaction and includes the specified fields as properties.

Parameters

The getOrderItems() function accepts an array of sublist line field IDs as a required parameter to specify the fields you want to retrieve from the Items sublist of the transaction.

Results for dropdown lists, multi-select fields, and image fields return the internal ID of the selected option or image. To retrieve the selected option label or the image relative URL in the File Cabinet, add the :text suffix to the field ID.

Examples

The following examples show how to use the getOrderItems() function.

Retrieving Item Internal IDs and Descriptions

In this example, getOrderItems() retrieves the internal IDs and descriptions for all line items on the transaction.

              getOrderItems(['item', 'description']); 

            

The resulting output may look like this:

              [
   {
        "item": "506",
        "description": "Large Display 24 button phone"
    },
    {
        "item": "502",
        "description": "Merlin display phone for support calls"
    }
] 

            

Related Topics

General Notices