Custom Segment Object Structure
This section describes how to create and modify a custom segment object in SuiteCloud Development Framework (SDF). The samples in this section are based on the campaign donor scenario. You can create the code samples in your SuiteCloud project to see how they all work together. For more information about setting up the scenario in your SuiteCloud project, see Campaign Donor Scenario Sample.
SDF only supports custom segments that use unified IDs. All custom segments that are created with SDF use unified IDs, and you can only import custom segments from a NetSuite account when they use unified IDs. If you import SDF custom objects that reference legacy custom segments that do not use unified IDs, the resulting XML definitions for those SDF custom objects may contain incorrect custom segment value references. For more information about creating custom segments with unified IDs in NetSuite, see Creating a Custom Segment.
Custom segments, defined by the customsegment
object, are comprised of several fields and structures. In addition to the customsegment
object, a customrecordtype
object must be created for each custom segment to represent the associated custom record. The associated custom record defines all the possible values of the associated custom segment. Each value is represented by an instance
structure. When you import a custom segment into a SuiteCloud project, the associated custom record gets imported with it. For more information about custom record type objects, see Custom Record Types as XML Definitions.
SuiteCloud IDE plug-in for WebStorm automatically creates an associated custom record every time you import a custom segment object.
The following is an example of a SELECT
custom segment, cseg_region
, that represents a geographical region. In the campaign donor scenario, a region can be applied to a donation campaign, a donor, and a donation transaction. To accomplish this, the segment is applied to the campaign custom record, donor custom record, and donation custom transaction. The file is saved as cseg_region.xml
in the Objects folder of the SuiteCloud project. The associated custom record, customrecord_cseg_region
, is saved as customrecord_cseg_region.xml
in the Objects folder of the SuiteCloud project. For more information about associated custom records and the structure of that file, see Associated Custom Record Type Object Structure.
<customsegment scriptid="cseg_region">
<defaultrecordaccesslevel>VIEW</defaultrecordaccesslevel>
<defaultsearchaccesslevel>VIEW</defaultsearchaccesslevel>
<defaultselection>[scriptid=customrecord_cseg_region._midwest]</defaultselection>
<fieldtype>SELECT</fieldtype>
<hasglimpact>F</hasglimpact>
<ismandatory>F</ismandatory>
<label>Region</label>
<recordtype>[scriptid=customrecord_cseg_region]</recordtype>
<valuesdisplayorder>SUBLIST</valuesdisplayorder>
<segmentapplication>
<transactionbody>
<applications>
<application>
<id>[scriptid=customtransaction_donation]</id>
<isapplied>T</isapplied>
</application>
</applications>
</transactionbody>
<transactionline>
</transactionline>
<entities>
</entities>
<crm>
</crm>
<items>
<subtype>BOTH</subtype>
</items>
<customrecords>
<applications>
<application>
<id>[scriptid=customrecord_campaign]</id>
<isapplied>T</isapplied>
</application>
<application>
<id>[scriptid=customrecord_donor]</id>
<isapplied>T</isapplied>
</application>
</applications>
</customrecords>
</segmentapplication>
<permissions>
<permission>
<recordaccesslevel>VIEW</recordaccesslevel>
<role>HUMAN_RESOURCES_GENERALIST</role>
<searchaccesslevel>VIEW</searchaccesslevel>
<valuemgmtaccesslevel>FULL</valuemgmtaccesslevel>
</permission>
</permissions>
</customsegment>
The following is an example of a MULTISELECT
custom segment, cseg_campaignmedium
, that represents a communication medium, such as e-mail or social media. In the campaign donor scenario, a medium can be applied to a donation campaign, so it is applied to the campaign custom record. The file is saved as cseg_campaignmedium.xml
in the Objects folder of the SuiteCloud project. The associated custom record, customrecord_cseg_campaignmedium
, is saved as customrecord_cseg_campaignmedium.xml
in the Objects folder of the SuiteCloud project. For more information about associated custom records and the structure of that file, see Associated Custom Record Type Object Structure.
<customsegment scriptid="cseg_campaignmedium">
<defaultrecordaccesslevel>VIEW</defaultrecordaccesslevel>
<defaultsearchaccesslevel>VIEW</defaultsearchaccesslevel>
<description></description>
<fieldtype>MULTISELECT</fieldtype>
<filteredby>[scriptid=cseg_region]</filteredby>
<hasglimpact>F</hasglimpact>
<help></help>
<ismandatory>F</ismandatory>
<label>Campaign Medium</label>
<recordtype>[scriptid=customrecord_cseg_campaignmedium]</recordtype>
<valuesdisplayorder>SUBLIST</valuesdisplayorder>
<segmentapplication>
<transactionbody>
</transactionbody>
<transactionline>
</transactionline>
<entities>
</entities>
<crm>
</crm>
<items>
<subtype>BOTH</subtype>
</items>
<customrecords>
<applications>
<application>
<id>[scriptid=customrecord_campaign]</id>
<isapplied>T</isapplied>
</application>
</applications>
</customrecords>
</segmentapplication>
</customsegment>
With the exception of the inactive field, custom segment objects support all primary information, account, and details fields displayed in the NetSuite UI. They support the Values, Permissions, Validation and Defaulting, and Application and Sourcing tabs. The following Application and Sourcing subtabs are supported by custom segment objects in SDF as part of the segmentapplication
structure:
-
Transactions are represented by the
transactionbody
structure. -
Transaction Columns are represented by the
transactionline
structure. -
Entities are represented by the
entities
structure. -
CRM are represented by the
crm
structure. -
Items are represented by the
items
structure. -
Custom Record Types are represented by the
customrecords
structure.
Some Application and Sourcing subtabs contain a sourcelist
element. This element is used for dynamic defaulting, where the segment on one custom record automatically populates with the value of the segment on another custom record. For more information about dynamic defaulting and acceptable sourcelist
values, see the following:
Each supported subtab in a segmentapplication
contains an applications
structure. These structures specify whether the custom segment should be applied to a record type in that subtab. For example, the customrecords
structure in the cseg_region
example sets the equivalent of the following NetSuite UI settings:

To modify or override an application setting in an account custom segment using SDF, you must explicitly reference the setting in the XML definition before deploying. For example, if a custom segment in an account is applied to a Campaign record type but you do not want it to apply, you must set the isapplied
value on the Campaign application to F in the SuiteCloud project before deploying. If you delete the Campaign application entry from the object instead and deploy, no changes are made to the application setting in the account.
When you apply a custom segment to a transaction type or column, the segment may have GL impact. To configure GL impact on a custom segment object, the hasglimpact
element must be set to T or F during the creation of the custom segment. This element cannot be changed after it has been specified. For more information, see Configuring GL Impact for a Custom Segment.
You cannot delete or uninstall a custom segment object from a SuiteApp project if the custom segment has GL impact and was already deployed to a target NetSuite account.
For more information about the customsegment
object, see customsegment.