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
-
With the SDFTutorial folder open in Visual Studio Code, select File > New File.
-
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.
-
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>
-
Save the file as
customrecord_tutorial.xml
in the subfolderSDFTutorial/src/Objects
. -
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
-
Right-click the Objects folder within the
SDFTutorial
project, and select New > Custom Object. -
Set the following properties:
-
From the Object Type list, select Record Type.
-
In the Script ID field, enter
customrecord_tutorial
.
-
-
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. -
Specify the values of the
recordname
andlabel
tags, and update the script ID attribute of thecustomrecordcustomfield
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 thecustrecord_tut_memo
script ID. -
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