Custom Segments as XML Definitions

Use custom segments to create custom classification fields for your business, such as class, department, and location. For more information about the benefits of custom segments, see Benefits of Custom Segments.

You can create and manage custom segments using SuiteCloud Development Framework (SDF). You can model custom segment types and their associated custom record types in a SuiteCloud project, and deploy the project to a target NetSuite account. You can either create new custom segments and associated custom record types in your project or import existing types from a NetSuite account. For more information about working with custom segments in a NetSuite account, see the following:

Custom segments have limitations, such as the transaction types that they support, and varied behavior, depending on how they are configured. In addition to these limitations, SDF only supports custom segments that use unified IDs, where the custom segment script ID is used for field IDs. For more information, see the following:

The following sub-sections illustrate how to model custom segment objects and their associated custom record types objects in SDF by using a sample scenario. In this scenario, a business saves records of donation campaigns, campaign donors, and the transactions between the two. There are two custom records — one to represent campaigns for raising donations, and one to represent donors of a campaign. In addition, a donation is represented as a custom transaction type, and the donor field on that transaction type is represented as a transaction body custom field. A custom segment is used to represent various geographical regions, which is applied to both campaigns and donors. Another custom segment is used to represent various communication mediums, which is applied to campaigns. The campaign donor scenario code samples are located in the following sub-sections:

Campaign Donor Scenario Sample

The code samples in this section set up the campaign donor sample scenario. You can create the code samples in your SuiteCloud project to see how they all work together.

The following custom record type object represents the campaign custom record, customrecord_campaign. It is saved as customrecord_campaign.xml in the Objects folder of the SuiteCloud project:

            <customrecordtype scriptid="customrecord_campaign">
    <accesstype>CUSTRECORDENTRYPERM</accesstype>
    <allowattachments>T</allowattachments>
    <allowinlinedeleting>F</allowinlinedeleting>
    <allowinlinedetaching>T</allowinlinedetaching>
    <allowinlineediting>F</allowinlineediting>
    <allowmobileaccess>F</allowmobileaccess>
    <allownumberingoverride>F</allownumberingoverride>
    <allowquickadd>T</allowquickadd>
    <allowquicksearch>F</allowquicksearch>
    <allowuiaccess>T</allowuiaccess>
    <enabledle>T</enabledle>
    <enablekeywords>T</enablekeywords>
    <enablemailmerge>F</enablemailmerge>
    <enablenumbering>F</enablenumbering>
    <enableoptimisticlocking>T</enableoptimisticlocking>
    <enablesystemnotes>T</enablesystemnotes>
    <hierarchical>F</hierarchical>
    <iconbuiltin>T</iconbuiltin>
    <includeinsearchmenu>T</includeinsearchmenu>
    <includename>T</includename>
    <isinactive>F</isinactive>
    <isordered>F</isordered>
    <recordname>Campaign</recordname>
    <showcreationdate>F</showcreationdate>
    <showcreationdateonlist>F</showcreationdateonlist>
    <showid>F</showid>
    <showlastmodified>F</showlastmodified>
    <showlastmodifiedonlist>F</showlastmodifiedonlist>
    <shownotes>T</shownotes>
    <showowner>F</showowner>
    <showownerallowchange>F</showownerallowchange>
    <showowneronlist>F</showowneronlist>
    <customrecordcustomfields>
        <customrecordcustomfield scriptid="custrecord_description">
            <accesslevel>2</accesslevel>
            <allowquickadd>F</allowquickadd>
            <applyformatting>F</applyformatting>
            <checkspelling>F</checkspelling>
            <defaultchecked>F</defaultchecked>
            <displaytype>NORMAL</displaytype>
            <encryptatrest>F</encryptatrest>
            <fieldtype>TEXT</fieldtype>
            <globalsearch>F</globalsearch>
            <isformula>F</isformula>
            <ismandatory>F</ismandatory>
            <isparent>F</isparent>
            <label>Description</label>
            <rolerestrict>F</rolerestrict>
            <searchlevel>2</searchlevel>
            <showinlist>F</showinlist>
            <storevalue>T</storevalue>
        </customrecordcustomfield>
        <customrecordcustomfield scriptid="custrecord_start_date">
            <accesslevel>2</accesslevel>
            <allowquickadd>F</allowquickadd>
            <applyformatting>F</applyformatting>
            <checkspelling>F</checkspelling>
            <defaultchecked>F</defaultchecked>
            <displaytype>NORMAL</displaytype>
            <encryptatrest>F</encryptatrest>
            <fieldtype>DATE</fieldtype>
            <globalsearch>F</globalsearch>
            <isformula>F</isformula>
            <ismandatory>F</ismandatory>
            <isparent>F</isparent>
            <label>Date Start</label>
            <rolerestrict>F</rolerestrict>
            <searchlevel>2</searchlevel>
            <showinlist>F</showinlist>
            <storevalue>T</storevalue>
        </customrecordcustomfield>
        <customrecordcustomfield scriptid="custrecord_end_date">
            <accesslevel>2</accesslevel>
            <allowquickadd>F</allowquickadd>
            <applyformatting>F</applyformatting>
            <checkspelling>F</checkspelling>
            <defaultchecked>F</defaultchecked>
            <displaytype>NORMAL</displaytype>
            <encryptatrest>F</encryptatrest>
            <fieldtype>DATE</fieldtype>
            <globalsearch>F</globalsearch>
            <isformula>F</isformula>
            <ismandatory>F</ismandatory>
            <isparent>F</isparent>
            <label>Date End</label>
            <rolerestrict>F</rolerestrict>
            <searchlevel>2</searchlevel>
            <showinlist>F</showinlist>
            <storevalue>T</storevalue>
        </customrecordcustomfield>
    </customrecordcustomfields>
</customrecordtype> 

          

The following image shows how the customrecord_campaign object appears in NetSuite after it is deployed to the account. This object only creates the name field and the three custom fields on the left. The region and campaign medium fields are custom segments that are created from other SDF custom objects:

Campaign page with custom fields highlighted.

The following custom record type object represents the donor custom record, customrecord_donor. It is saved as customrecord_donor.xml in the Objects folder of the SuiteCloud project:

            <customrecordtype scriptid="customrecord_donor">
    <accesstype>CUSTRECORDENTRYPERM</accesstype>
    <allowattachments>T</allowattachments>
    <allowinlinedeleting>F</allowinlinedeleting>
    <allowinlinedetaching>T</allowinlinedetaching>
    <allowinlineediting>F</allowinlineediting>
    <allowmobileaccess>F</allowmobileaccess>
    <allownumberingoverride>F</allownumberingoverride>
    <allowquickadd>T</allowquickadd>
    <allowquicksearch>F</allowquicksearch>
    <allowuiaccess>T</allowuiaccess>
    <enabledle>T</enabledle>
    <enablekeywords>T</enablekeywords>
    <enablemailmerge>F</enablemailmerge>
    <enablenumbering>F</enablenumbering>
    <enableoptimisticlocking>T</enableoptimisticlocking>
    <enablesystemnotes>T</enablesystemnotes>
    <hierarchical>F</hierarchical>
    <iconbuiltin>T</iconbuiltin>
    <includeinsearchmenu>T</includeinsearchmenu>
    <includename>T</includename>
    <isinactive>F</isinactive>
    <isordered>F</isordered>
    <recordname>Donor</recordname>
    <showcreationdate>F</showcreationdate>
    <showcreationdateonlist>F</showcreationdateonlist>
    <showid>F</showid>
    <showlastmodified>F</showlastmodified>
    <showlastmodifiedonlist>F</showlastmodifiedonlist>
    <shownotes>T</shownotes>
    <showowner>F</showowner>
    <showownerallowchange>F</showownerallowchange>
    <showowneronlist>F</showowneronlist>
    <customrecordcustomfields>
        <customrecordcustomfield scriptid="custrecord_first_name">
            <accesslevel>2</accesslevel>
            <allowquickadd>F</allowquickadd>
            <applyformatting>F</applyformatting>
            <checkspelling>F</checkspelling>
            <defaultchecked>F</defaultchecked>
            <displaytype>NORMAL</displaytype>
            <encryptatrest>F</encryptatrest>
            <fieldtype>TEXT</fieldtype>
            <globalsearch>F</globalsearch>
            <isformula>F</isformula>
            <ismandatory>F</ismandatory>
            <isparent>F</isparent>
            <label>First Name</label>
            <rolerestrict>F</rolerestrict>
            <searchlevel>2</searchlevel>
            <showinlist>F</showinlist>
            <storevalue>T</storevalue>
        </customrecordcustomfield>
        <customrecordcustomfield scriptid="custrecord_last_name">
            <accesslevel>2</accesslevel>
            <allowquickadd>F</allowquickadd>
            <applyformatting>F</applyformatting>
            <checkspelling>F</checkspelling>
            <defaultchecked>F</defaultchecked>
            <displaytype>NORMAL</displaytype>
            <encryptatrest>F</encryptatrest>
            <fieldtype>TEXT</fieldtype>
            <globalsearch>F</globalsearch>
            <isformula>F</isformula>
            <ismandatory>F</ismandatory>
            <isparent>F</isparent>
            <label>Last Name</label>
            <rolerestrict>F</rolerestrict>
            <searchlevel>2</searchlevel>
            <showinlist>F</showinlist>
            <storevalue>T</storevalue>
        </customrecordcustomfield>
    </customrecordcustomfields>
</customrecordtype> 

          

The following image shows how the customrecord_donor object appears in NetSuite after it is deployed to the account. The region field is a custom segment that is created from another SDF custom object:

Donor page with fields highlighted.

The following transaction type object, customtransaction_donation, represents a journal of donation transactions. It is saved as customtransaction_donation.xml in the Objects folder of the SuiteCloud project:

            <customtransactiontype scriptid="customtransaction_donation">
    <isposting>F</isposting>
    <isvoidable>F</isvoidable>
    <name>Donations</name>
    <showstatus>F</showstatus>
    <subliststyle>JOURNAL</subliststyle>
    <segments>
        <classposition>NONE</classposition>
        <departmentposition>NONE</departmentposition>
        <locationposition>NONE</locationposition>
    </segments>
</customtransactiontype> 

          

The following transaction body custom field object, custbody_donor_field, represents a donor field that appears in the custom tab of the donation transaction type. It is saved as custbody_donor_field.xml in the Objects folder of the SuiteCloud project:

            <transactionbodycustomfield scriptid="custbody_donor_field">
    <accesslevel>2</accesslevel>
    <applyformatting>F</applyformatting>
    <bodycustomerpayment>F</bodycustomerpayment>
    <bodycustomtransactions>[scriptid=customtransaction_donation]</bodycustomtransactions>
    <bodydeposit>F</bodydeposit>
    <bodyexpensereport>F</bodyexpensereport>
    <bodyinventoryadjustment>F</bodyinventoryadjustment>
    <bodyitemfulfillment>F</bodyitemfulfillment>
    <bodyitemfulfillmentorder>F</bodyitemfulfillmentorder>
    <bodyitemreceipt>F</bodyitemreceipt>
    <bodyitemreceiptorder>F</bodyitemreceiptorder>
    <bodyjournal>F</bodyjournal>
    <bodyopportunity>F</bodyopportunity>
    <bodyothertransaction>F</bodyothertransaction>
    <bodypickingticket>F</bodypickingticket>
    <bodyprintflag>F</bodyprintflag>
    <bodyprintpackingslip>F</bodyprintpackingslip>
    <bodyprintstatement>F</bodyprintstatement>
    <bodypurchase>F</bodypurchase>
    <bodysale>F</bodysale>
    <bodystore>F</bodystore>
    <bodytransferorder>F</bodytransferorder>
    <bodyvendorpayment>F</bodyvendorpayment>
    <checkspelling>F</checkspelling>
    <defaultchecked>F</defaultchecked>
    <displaytype>NORMAL</displaytype>
    <encryptatrest>F</encryptatrest>
    <fieldtype>SELECT</fieldtype>
    <globalsearch>F</globalsearch>
    <isformula>F</isformula>
    <ismandatory>F</ismandatory>
    <isparent>F</isparent>
    <label>Donor</label>
    <onparentdelete>NO_ACTION</onparentdelete>
    <searchlevel>2</searchlevel>
    <selectrecordtype>[scriptid=customrecord_donor]</selectrecordtype>
    <showhierarchy>F</showhierarchy>
    <showinlist>F</showinlist>
    <storevalue>T</storevalue>
</transactionbodycustomfield> 

          

The following image shows how the customtransaction_donation object appears in NetSuite after it is deployed to the account with custbody_donor_field. The region field is a custom segment that is created from another SDF custom object:

The Donations page

For more information about the custom segment samples for this scenario, and their associated custom record types, see the following:

Related Topics

General Notices