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.
-
To create a script record and script deployment definition in WebStorm.
To create a script record and script deployment definition in Visual Studio Code
-
With the SDFTutorial folder open in Visual Studio Code, select File > New 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
-
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>
-
Save the file as
customscript_userevent.xml
in the subfolderSDFTutorial/Objects
. -
Press Ctrl+Shift+P to open the Command Palette, and enter
suitecloud
and from the dropdown list. Then select SuiteCloud: Add Dependency References to the Manifest.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> <feature required="false">CREATESUITEBUNDLES</feature> </features> </dependencies>
-
To create a script record and script deployment definition in WebStorm
-
Select the Objects folder within the
SDFTutorial
project, and select File > New > Custom Object. -
Set the following properties:
-
From the Object Type drop-down list, select Script – User Event.
-
In the Script ID field, enter
customscript_userevent.
-
-
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. -
Specify the values of the
name
,scriptfile
andrecordtype
tags, and update the script ID attribute of thescriptdeployment
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>
-
Save the file.
-
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