Example of Adding a Custom Segment Value

This example also shows how to add a value to a custom segment.

The way you identify a custom segment varies depending on the endpoint and operation you are using. This example uses the 2016.1 endpoint. It shows how to identify the segment by using the segment’s Record ID value. This method of identifying the segment during an add operation is available only with the 2013.2 endpoint and later.

In this example, the segment has a record ID of customrecord_cseg_profitcenter.

For details on identifying custom segments and their values, see Identifying Custom Segments and Values.

C#

          private void addSegmentValue()
{ CustomizationRef myRef = new CustomizationRef(); myRef.type = RecordType.customRecordType; myRef.scriptId = "customrecord_cseg_profitcenter"; myRef.typeSpecified = true; CustomRecord myNewSegmentValue = new CustomRecord(); myNewSegmentValue.recType = myRef; myNewSegmentValue.name = "Apparel"; myNewSegmentValue.externalId = "Apparel"; _service.add(myNewSegmentValue); } 

        

SOAP Request

          <soap:Body>
   <add xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <record externalId="Apparel" xsi:type="q1:CustomRecord" xmlns:q1="urn:customization_2017_1.setup.webservices.netsuite.com">
         <q1:name>Apparel</q1:name>
         <q1:recType scriptId="customrecord_cseg_profitcenter" type="customRecordType" xsi:type="q2:CustomizationRef" xmlns:q2="urn:core_2017_1.platform.webservices.netsuite.com"/>
      </record>
   </add>
</soap:Body> 

        

SOAP Response

          <soapenv:Body>
   <addResponse 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" externalId="Apparel" internalId="8" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
      </writeResponse>
   </addResponse>
</soapenv:Body> 

        

Related Topics

Working With Custom Segment Values
Identifying Custom Segment Values
Example of Dynamic Discovery of Existing Custom Segments
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