Create a Script Record and Script Deployment Definition

This is step six of the SuiteCloud Development Framework Tutorial. If you have not already done so, complete step five: Create a User Event Script.

To apply the user event script to the SuiteCloud Development Framework (SDF) Tutorial record type, create a script record for the user event and a script deployment definition. For more information, see Script Record Creation and Script Deployment.

The following steps show you how to create a user event script record and script deployment definition. Depending on your IDE, refer to one of the following procedures:

To create a script record and script deployment 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 script record and script deployment record definitions. Although you cannot create those definitions from a template using SuiteCloud Extension for Visual Studio Code, you can import the definitions 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:

                    <usereventscript scriptid="customscript_userevent">
        <description></description>
        <isinactive></isinactive>
        <name>SDF Tutorial User Event</name>
        <notifyowner>T</notifyowner>
        <scriptfile>[/SuiteScripts/UserEventScript.js]</scriptfile>
        <scriptdeployments>
            <scriptdeployment scriptid="customdeploy_ue_tut">
                <isdeployed>T</isdeployed>
                <loglevel>DEBUG</loglevel>
                <recordtype>[customrecord_tutorial]</recordtype>
                <status>TESTING</status>
            </scriptdeployment>
        </scriptdeployments>
    </usereventscript> 
    
                  
  4. Save the file as customscript_userevent.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>
            <feature required="true">SERVERSIDESCRIPTING</feature>
        </features>
    </dependencies> 
    
                  

To create a script record and script deployment 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 Script – User Event.

    • In the Script ID field, enter customscript_userevent.

  3. Click OK.

    The customscript_userevent object is based on a template that partially defines a script record. The new file contains errors that get resolved when certain tags are specified.

  4. Specify the values of the name, scriptfile and recordtype tags, and update the script ID attribute of the scriptdeployment tag.

    Your customscript_userevent.xml file should look like the following:

                    <usereventscript scriptid="customscript_userevent">
          <name>SDF Tutorial User Event</name>
          <notifyowner>T</notifyowner>
          <scriptfile>[/SuiteScripts/UserEventScript.js]</scriptfile>
          <scriptdeployments>
             <scriptdeploymentscriptid="customdeploy_ue_tut">
                   <isdeployed>T</isdeployed>
                   <loglevel>DEBUG</loglevel>
                   <recordtype>[customrecord_tutorial]</recordtype>
                   <status>TESTING</status>
             </scriptdeployment> 
          </scriptdeployments> 
    </usereventscript> 
    
                  
  5. Save the file.

  6. Right-click the manifest.xml file within the SDFTutorial project, and select NetSuite > Add Dependency References to Manifest.

Continue to Step Seven: Validate and Deploy the SuiteCloud Project to a Target NetSuite Account.

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 Custom Record Definition
Create a User Event Script
Validate and Deploy the SuiteCloud Project to a Target NetSuite Account
Test the SuiteCloud Project in the Target NetSuite Account

General Notices