Create a Custom Record Definition

This topic is step four of the SuiteCloud Development Framework Tutorial. If you have not already done so, complete step three: Create an Account Customization Project.

SuiteCloud IDE plug-in includes templates for each supported object type and includes code completion for all supported object definitions. You can use these templates as a base to define SDF custom objects for a SuiteCloud project. In this manner, you can add or edit SDF custom objects in the SuiteCloud IDE plug-in.

The following steps show you how to create a custom record object that contains a single text field. For more information about custom records, see Custom Records.

Depending on your IDE, refer to one of the following procedures:

To create a custom record definition in Visual Studio Code

  1. With the SDFTutorial folder open in Visual Studio Code, select File > New File.

  2. In the Command Palette, select Text File.

    Note:

    This procedure manually creates the custom record definition. Although you cannot create a custom record definition from a template using SuiteCloud Extension for Visual Studio Code, you can import a custom record definition from your NetSuite account. For more information, see Importing SDF Custom Objects from a NetSuite Account with SuiteCloud Extension for Visual Studio Code.

  3. Enter the following code into the new file:

                    <customrecordtype scriptid="customrecord_tutorial">
        <description></description>
        <recordname>SDF Tutorial</recordname>
        <customrecordcustomfields>
            <customrecordcustomfield scriptid="custrecord_tut_memo">
                <description></description>
                <displaytype>NORMAL</displaytype>
                <fieldtype>TEXT</fieldtype>
                <label>Memo</label>
                <ismandatory>F</ismandatory>
            </customrecordcustomfield>
        </customrecordcustomfields>
    </customrecordtype> 
    
                  
  4. Save the file as customrecord_tutorial.xml in the subfolder SDFTutorial/src/Objects.

  5. Press Ctrl+Shift+P to open the Command Palette, and enter suitecloud. From the dropdown list, select SuiteCloud: Add Dependency References to the Manifest. For more information, see Adding Dependencies to the Manifest in SuiteCloud Extension for Visual Studio Code.

    Tip:

    You can also use the following keyboard shortcuts to add dependencies:

    • Linux: Press Ctrl+Shift+Alt+A

    • Mac OS: Press Ctrl+Alt+Cmd+A

    • Windows: Press Ctrl+Shift+Alt+A

    The command adds the following code to the manifest:

                    <dependencies>
        <features>
            <feature required="true">CUSTOMRECORDS</feature>
        </features>
    </dependencies> 
    
                  

To create a custom record definition in WebStorm

  1. Select the Objects folder within the SDFTutorial project, and select File > New > Custom Object.

  2. Set the following properties:

    • From the Object Type list, select Record Type.

    • In the Script ID field, enter customrecord_tutorial.

  3. Click OK.

    The customrecord_tutorial object is created based on a template that partially defines a single custom record field. The new file contains errors that are resolved when you specify a record name and a label for the custom record field.

  4. Specify the values of the recordname and label tags, and update the script ID attribute of the customrecordcustomfield tag.

    Your customrecord_tutorial.xml file should look like the following code sample:

                    <customrecordtype scriptid="customrecord_tutorial">
          <allowattachments>T</allowattachments>
          <allowinlinedetaching>T</allowinlinedetaching>
          <allowquickadd>T</allowquickadd
          <enabledle>T</enabledle>
          <enablekeywords>T</enablekeywords>
          <enableoptimisticlocking>T</enableoptimisticlocking>
          <enablesystemnotes>T</enablesystemnotes>
          <iconbuiltin>T</iconbuiltin>
          <includeinsearchmenu>T</includeinsearchmenu>
          <includename>T</includename>
          <shownotes>T</shownotes>
          <recordname>SDF Tutorial</recordname>
          <customrecordcustomfields>
                   <customrecordcustomfieldscriptid="custrecord_tut_memo">
                         <accesslevel>2</accesslevel>
                         <description></description> 
                         <displaytype>NORMAL</displaytype>
                         <fieldtype>TEXT</fieldtype>
                         <label>MEMO</label>
                         <searchlevel>2</searchlevel>
                         <storevalue>T</storevalue>
                   </customrecordcustomfield>
          </customrecordcustomfields>
    </customrecordtype> 
    
                  

    The preceding code sample creates a custom record type object for an SDF Tutorial record with the customrecord_tutorial script ID. The record contains a text field with the custrecord_tut_memo script ID.

  5. Save the file.

Continue to Step Five: Create a User Event Script.

Related Topics

SuiteCloud Development Framework Tutorial
Set Up a NetSuite Account (Administrator Only)
Set Up Your IDE Environment
Create an Account Customization Project
Create a User Event Script
Create a Script Record and Script Deployment Definition
Validate and Deploy the SuiteCloud Project to a Target NetSuite Account
Test the SuiteCloud Project in the Target NetSuite Account

General Notices