Example of Dynamic Discovery of Existing Custom Segments
You can dynamically discover the record ID of custom segments.
Listing Existing Custom Segments
You can use the getCustomizationId operation to return a list of existing custom segments. For information about using this operation, see getCustomizationId.
SOAP Request
<soapenv:Body> <getCustomizationId xmlns="urn:messages_2019_1.platform.webservices.netsuite.com"> <customizationType getCustomizationType="customSegment"/> <includeInactives>false</includeInactives> </getCustomizationId> </soapenv:Body>
SOAP Response
<soapenv:Body> <getCustomizationIdResponse xmlns="urn:messages_2019_1.platform.webservices.netsuite.com"> <platformCore:getCustomizationIdResult xmlns:platformCore="urn:core_2019_1.platform.webservices.netsuite.com"> <platformCore:status isSuccess="true"/> <platformCore:totalRecords>2</platformCore:totalRecords> <platformCore:customizationRefList> <platformCore:customizationRef scriptId="cseg_testws" internalId="1" type="customSegment"> <platformCore:name>TestWS</platformCore:name> </platformCore:customizationRef> <platformCore:customizationRef scriptId="cseg_anothertest" internalId="101" type="customSegment"> <platformCore:name>WS191</platformCore:name> </platformCore:customizationRef> </platformCore:customizationRefList> </platformCore:getCustomizationIdResult> </getCustomizationIdResponse> </soapenv:Body>
Getting Information About the Custom Segment Record Type
To get more information about a custom segment, you can use the get operation with the custom segment record type with the references you collected when you listed existing custom segments.
Java
public void getCustomSegmentRecord() throws Exception { RecordRef customSegment = new RecordRef(); customSegment.setInternalId("1"); customSegment.setType(RecordType.customSegment); c.getRecord(customSegment);
SOAP Sample
<soapenv:Body> <get xmlns="urn:messages_2019_1.platform.webservices.netsuite.com"> <baseRef internalId="1" type="customSegment" xsi:type="ns7:RecordRef" xmlns:ns7="urn:core_2019_1.platform.webservices.netsuite.com"/> </get> </soapenv:Body>
SOAP Response
<soapenv:Body> <getResponse xmlns="urn:messages_2019_1.platform.webservices.netsuite.com"> <readResponse> <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2019_1.platform.webservices.netsuite.com"/> <record internalId="1" xsi:type="setupCustom:CustomSegment" xmlns:setupCustom="urn:customization_2019_1.setup.webservices.netsuite.com"> <setupCustom:label>TestWS</setupCustom:label> <setupCustom:scriptId>cseg_testws</setupCustom:scriptId> <setupCustom:recordScriptId>customrecord_cseg_testws</setupCustom:recordScriptId> <setupCustom:recordType internalId="45" xmlns:platformCore="urn:core_2019_1.platform.webservices.netsuite.com"> <platformCore:name>TestWS</platformCore:name> </setupCustom:recordType> <setupCustom:fieldType>_listRecord</setupCustom:fieldType> <setupCustom:isInactive>false</setupCustom:isInactive> <setupCustom:showInList>false</setupCustom:showInList> <setupCustom:hasGLImpact>false</setupCustom:hasGLImpact> <setupCustom:isMandatory>false</setupCustom:isMandatory> </record> </readResponse> </getResponse> </soapenv:Body>
Getting Information About the Related Custom Record Type
To get more details about the related custom record type, you can also use the get or getList operation for the CustomRecordType with the references you collected when you listed existing custom segments.
SOAP Request
<soapenv:Body> <get xmlns="urn:messages_2017_1.platform.webservices.netsuite.com"> <baseRef internalId="24" scriptId="customrecord_cseg_example" type="customRecordType" xsi:type="ns7:CustomizationRef" xmlns:ns7="urn:core_2017_1.platform.webservices.netsuite.com"> <ns7:name xsi:type="xsd:string">WS Segment Example</ns7:name> </baseRef> </get>
</soapenv:Body>
Getting the Values of a Custom Segment
To get the values of a custom segment, use a CustomRecordSearch operation using a reference from the second step as the record type filter.
SOAP Request
<soapenv:Body> <search xmlns="urn:messages_2017_1.platform.webservices.netsuite.com"> <searchRecord xsi:type="ns7:CustomRecordSearchBasic" xmlns:ns7="urn:common_2017_1.platform.webservices.netsuite.com"> <ns7:recType internalId="24" scriptId="customrecord_cseg_example" type="customRecordType" xsi:type="ns8:CustomizationRef" xmlns:ns8="urn:core_2017_1.platform.webservices.netsuite.com"> <ns8:name xsi:type="xsd:string">WS Segment Example</ns8:name> </ns7:recType> </searchRecord> </search>
</soapenv:Body>
Related Topics
- Working With Custom Segment Values
- Identifying Custom Segment Values
- 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