Global API
Apex Generator

Adding Standard Fields

4min

In this document, we will explain how to add any new Standard Field to the Apex Generator code. This is an example of creating a Sales Order using an Apex generator code. The procedure is the same for other transactions. In the below example, we will explain how to add the standard field called terms.

Follow these two steps to add standard fields to the Apex Generator's code.

1. Know the Standard Fields

Go to the respective Global API request object. Look for the NetSuite API Name and Datatype of the standard field you want to add.

Example: Standard fields supported by the Sales Order

2. Declare the Standard Fields

Fields are declared/added inside the "Requests" class. So, navigate to the "Requests" class, paste the below code snippet inside the "Requests" class, and edit it as per the requirement. Ensure that the field label, description, datatype, and variable name match your NetSuite Standard field.

Apex Generator Code


3. Initialize the standard fields and Add them to the map

Standard fields should be initialized inside the "generateNetSuiteSalesOrderMap" method. To initialize the standard fields, paste the code snippet below in the "generateNetSuiteSalesOrderMap" method after initializing the variable "netSuiteSalesOrderMap" and edit them as required.

Note: Terms is a Reference Field in NetSuite, so we need to pass it's internalId

Apex Generator Code


Note: The complete example is given below, and for the sake of code readability and length, a few fields that would auto-populate by the Apex generator are removed here

Apex Generator Code