Identifying Custom Segments and Values

To work with custom segment values, you must know how to identify the appropriate custom segment. Additionally, depending on the task you want to complete, you may have to know how to identify a particular value. For details, see the following sections:

Identifying Custom Segments

There are multiple ways to identify a custom segment. If you are using an endpoint that predates 2016.1, there are some limitations as described in the next section.

Endpoint Requirements

The exact way you identify a custom segment varies depending on the operation and the endpoint you are using. For details, see the following table.

 

2013.2 - 2015.2

2016.1 and Later

add, update, or upsert

The Custom Segment’s Record ID

or

The Custom Record Type’s Internal ID

The Custom Segment’s Record ID

or

The Custom Record Type’s Internal ID

get or delete

The Custom Record Type’s Internal ID

The Custom Segment’s Record ID

or

The Custom Record Type’s Internal ID

The Custom Segment’s Record ID

In some cases, you can identify a custom segment by the Record ID value displayed on the segment definition.

You can find the Record ID value by viewing the segment in the UI. Custom segment definitions are available at Customization > Lists, Records, & Fields > Custom Segments. The Record ID field is displayed on the body of the segment.

The record ID of a custom segment in the UI.

If you are doing an add, update, or upsert, you use this value in conjunction with the CustomizationRef class. Set the CustomizationRef’s scriptId as equal to the segment’s Record ID. For an example, see Example of Adding a Custom Segment Value.

If you are doing a get or delete, you use this value in conjunction with the CustomRecordRef class. Set the CustomRecordRef’s scriptId as equal to the segment’s Record ID. For an example, see Example of Getting a Custom Segment Value by Using Record ID.

The Custom Record Type’s Internal ID

In some cases, you must identify the custom record type by identifying the custom record type associated with the segment. With this approach, you must use the internal ID associated with that record type. This value cannot be retrieved through the NetSuite UI. However, you can retrieve the internal ID for these custom record types if you interact with them by adding, updating, or upserting a value for the custom segment in conjunction with the 2013.2 endpoint or later. When you do, the SOAP response includes the appropriate internal ID.

The following snippet shows the SOAP response to an update operation. Notice that the response includes a typeId attribute. The value of this attribute (in this example, 39) is the internal ID of the custom record type that corresponds with the custom segment that was identified in the update request.

          <soapenv:Body> <updateResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com"> <writeResponse> <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/> <baseRef xsi:type="platformCore:CustomRecordRef" typeId="39" internalId="108" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/> </writeResponse>
</updateResponse> 

        

You can use this value to identify the record type in subsequent interactions with this segment’s values. As described in Endpoint Requirements, using this value is the only option for certain endpoints and certain operations.

If you are doing an add, update, or upsert, you use this value in conjunction with the RecordRef class. Set the RecordRef’s internalId as equal to this value. For an example, see Example of Updating a Custom Segment Value.

If you are doing a get or delete, you use this value in conjunction with the CustomRecordRef class. Set the CustomRecordRef’s typeId as equal to this value. For an example, see Example of Getting a Custom Segment Value by Using Type Internal ID.

Identifying Custom Segment Values

If you want to update or delete a specific custom segment value, you must identify it first. You can identify it by using the methods described in the following table and screenshot.

Method

Description

Callout

External ID

A string value that is available only if you created it (by using SOAP web services, CSV Import Assistant, or SuiteScript).

ID

An integer visible when you view the custom segment definition in the UI.

Callout number 1

Name

A string value visible when you view the custom segment definition in the UI.

Callout number 2
The values of a custom segment in the UI.

You always identify segment values by using the CustomRecord class.

Related Topics

Working With Custom Segment Values
Example of Dynamic Discovery of Existing Custom Segments
Example of Adding a Custom Segment Value
Example of Updating a Custom Segment Value
Example of Getting a Custom Segment Value by Using Record ID
Example of Deleting a Custom Segment Value by Using Record ID
Example of Getting a Custom Segment Value by Using Type Internal ID
Example of Deleting a Custom Segment Value by Using Type Internal ID

General Notices