getSelectValue

In SOAP web services, you can use the getSelectValue operation to retrieve valid select options for a particular RecordRef, CustomRecordRef, or enumerated static field. This is useful if you are writing an application UI that needs to mimic NetSuite UI logic, if the referenced record type is not yet exposed in SOAP web services, or when the logged-in user's role does not have permission to the instances of the referenced record type. A call to getSelectValue may return different results for the same field for different roles.

The getSelectValue operation can be used on standard body fields and custom body fields. It can also be used on sublist fields that appear on both standard and custom records.

SOAP Request

The following sample shows the usage of the getSelectValue operation.

            <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org
soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001
XMLSchema-instance">
 <soapenv:Header>
  <ns1:passport soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0"
     xmlns:ns1="urn:messages_2025_1.platform.webservices.netsuite.com">
  <ns2:email xmlns:ns2="urn:core_2025_1.platform.webservices.netsuite.com">kwolfe@netsuite.com<
    ns2:email>
 <ns3:password xmlns:ns3="urn:core_2025_1.platform.webservices.netsuite.com"><SOAP web services password><
   ns3:password>
<ns4:account xmlns:ns4="urn:core_2025_1.platform.webservices.netsuite.com">000071</ns4:account
<ns5:role internalId="37" xmlns:ns5="urn:core_2025_1.platform.webservices.netsuite.com"/>
  </ns1:passport>
 </soapenv:Header>
 <soapenv:Body>
  <getSelectValue xmlns="urn:messages_2025_1.platform.webservices.netsuite.com">
   <fieldDescription>
    <ns6:recordType xmlns:ns6="urn:core_2025_1.platform.webservices.netsuite.com">salesOrder<
       ns6:recordType>
<ns7:sublist xmlns:ns7="urn:core_2025_1.platform.webservices.netsuite.com">itemList</ns7:sublist>
<ns8:field xmlns:ns8="urn:core_2025_1.platform.webservices.netsuite.com">item</ns8:field>
<ns9:filterByValueList xmlns:ns9="urn:core_2025_1.platform.webservices.netsuite.com">
     <ns9:filterBy>
      <ns9:field>entity</ns9:field>
      <ns9:internalId>8</ns9:internalId>
     </ns9:filterBy>
    </ns9:filterByValueList>
   </fieldDescription>
   <pageIndex>1</pageIndex>
  </getSelectValue>
 </soapenv:Body>
</soapenv:Envelope> 

          

In REST web services, you send a selectOptions request using the same URL structure as any other REST record service operation, but you must add an Accept request header and the list of requested fields in the fields= query parameter. The following examples show the basic structure of a selectOptions request.

REST Request

The following request returns the select option values on a new record instance.

            POST ../services/rest/record/v1/customer?fields=entitystatus
Accept: application/vnd.oracle.resource+json; type=select-options 

          

The select option values returned by the selectOptions operation can depend on the values of other field values on a record. The request body can be empty, or it can include field values for fields that the select option values depend on.

In the following example, a request for select option values is sent for the dueToFromSubsidiary field on the line sublist. The value depends on the value of the subsidiary field and the values of the subsidiary and eliminate fields on the line sublist.

            POST ../services/rest/record/v1/advInterCompanyJournalEntry?fields=line.dueToFromSubsidiary
Accept: application/vnd.oracle.resource+json; type=select-options
{
  "subsidiary": {
    "id": 1
  },
  "line": {
    "items": [
      {
        "subsidiary": {
          "id": 1
        },
        "eliminate": true
      }
    ]
  }
} 

          

REST Response

The response contains the select option values for all fields in the fields= query parameter.

            Content-Type: application/vnd.oracle.resource+json; type=select-options
{
  "links": [
    {
      "rel": "self",
      "method": "POST",
      "mediaType": "application/vnd.oracle.resource+json; type=select-options",
      "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer?fields=entitystatus"
    }
  ],
  "entitystatus": {
    "_selectOptions": {
      "links": [
        {
          "rel": "self",
          "method": "POST",
          "mediaType": "application/vnd.oracle.resource+json; type=select-options",
          "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer?fields=entitystatus"
        }
      ],
      "items": [
        {
          "id": 16,
          "refName": "CUSTOMER-Lost Customer"
        },
        {
          "id": 13,
          "refName": "CUSTOMER-Closed Won"
        },
        {
          "id": 15,
          "refName": "CUSTOMER-Renewal"
        }
      ],
      "count": 3,
      "offset": 0,
      "hasMore": false,
      "totalResults": 3
    }
  }
} 

          

Related Topics

General Notices