How to use NetSuite SDF CLI, CLI for Node.js on Mac, suitecloud command-CarlZeng
NetSuite SDF CLI CLI for Node.js on Mac
Installation
Java SE Development Kit — CLI for Node.js requires Oracle JDK version 11.
- If you find your JAVA JDK version is not yet 11, you can download it from: https://www.oracle.com/java/technologies/javase-jdk11-downloads.html
Node.js — CLI for Node.js requires Node.js version 12.14.0 LTS or greater.
If you find your Node version is not yet 12.14.0, you can install it by Terminal: npm install -g @oracle/suitecloud-cli.
Notes:
This package has installed:
• Node.js v12.14.0 to /usr/local/bin/node
• npm v6.13.4 to /usr/local/bin/npm
Make sure that /usr/local/bin is in your $PATH.
How to run SDF CLI for Node.js
MacOS tools
- Terminal (Mac build-in)
- iTerm2
CLI for Node.js Commands
suitecloud
Command
Description
account:ci
Set up an account to use with the SuiteCloud CLI for Node.js.
This command only supports non-interactive mode.
Manages authentication IDs (authid) for all your projects.
Set up an account to use with the SuiteCloud CLI for Node.js.
This command only supports interactive mode.
Configure a proxy server.
Import files from an account to your account customization project.
Lists the files in the File Cabinet of your account.
Uploads files from your project to an account.
Import custom objects from an account to your SuiteCloud project.
List the custom objects deployed in an account.
Overwrite the custom objects in the project with the custom objects in an account.
Adds missing dependencies to the manifest file.
Create a SuiteCloud project, either a SuiteApp or an account customization project (ACP).
Deploy the folder containing the project.
Generates a ZIP file from your project, respecting the structure specified in the deploy.xml file, and applying local validation.
Validate the folder containing the SuiteCloud project.
Generate a local server of your SuiteCommerce extensions and themes.
Sample
- suitecloud account:setup
Application SuiteCloud IDE & CLI would like to access your account XXX (DEV) as Administrator <carl.zeng@.com>
The authentication process will continue in your SuiteCloud SDK application. Close this window and go to your application to check the progress of the process.
- suitecloud object:import -i
The following objects have been imported:
- customrecordtype:
- usereventscript:
- Referenced SuiteScript files:
- suitecloud project:adddependencies
- Added dependencies to profile
- suitecloud account:setup
- Setup login, 2FA, Token, for target NetSuite Account
- suitecloudproject:deploy
- Deploy imported elements to target NetSuite Account
Practice
-—-DOWNLOAD—–
(mkdir SDF_Top)
cd SDF_Top
suitecloud project:create -i
- Created new project(SDF_Test1), it will create new folder under SDF_Top with project name: SDF_Test1.
cd SDF_Test1
suitecloud account:setup
Now this folder is the main project folder
suitecloud object:import -i
? Do you want to import all object types? Yes
? Do you want to enter a script ID to filter your list? Yes
? Enter the full or partial script ID. _track
? Select the objects you want to import (Press
to select, to toggle all, to invert selection)
-—-UPLOAD—–
suitecloud account:setup
Create a new authentication ID (authID).
suitecloud project:adddependencies
suitecloud project:validate
The validation process has finished.
suitecloud project:deploy
Installation COMPLETE
—–Troubleshooting—–
#1. Error message:
An error occurred during file validation.
Details: Resource files can only be uploaded into the /SuiteScripts/,
/Templates/E-mail Templates/,
/Templates/Marketing Templates/,
/Web Site Hosting Files/ folder.
File: ~/FileCabinet/.DS_Store
For Mac, you might need to: rm ~/FileCabinet/.DS_Store and rm ~/FileCabinet/Templates/.DS_Store
Since suitecloud project:deploy is trying to deploy those hidden files and trigger error: An error occurred during file validation. Details: Resource files can only be uploaded into the /SuiteScripts/, /Templates/E-mail Templates/, /Templates/Marketing Templates/, /Web Site Hosting Files/ folder.
#2. Error Message:
An error occurred during account settings validation.
Details: The manifest contains a dependency on /SuiteScripts/Project_Name/ScriptFileName.js file, but it is not in the account.
When we saw this, it means we need to deploy the script file first. We can upload them in filecabinet OR deploy like this:
1. Deploy Files
1.1 Comment out Dependencies files in manifest.xml. I.e. <!-
1.2 Comment out whole section in deploy.xml. I.e. <!-
1.3 suitecloud project:deploy
#3. Error Message:
An error occurred during deploy file validation.
Details: The deploy file is invalid at line 2, column(s) 20 - cvc-complex-type.2.4.a: Invalid content was found starting with element ‘configuration’. One of ‘{configurations, objects, files, translationimports}’ is expected..
File: ~/deploy.xml
We must comment out no need deployment section/context by <!- –>. I.e.
#4. Error Message: (When we deploy Script Record Object, we might facing error)
Validation failed.
An error occurred during custom object validation. (customscript_scriptinternalid)
Details: The file reference /SuiteScripts/Project_Name/ScriptFileName.js is missing in the project and also not included in the dependencies list.
File: ~/Objects/customscript_ScriptFileName.xml
We need to add(or uncomment) the dependencies in manifest.xml for script record object deployment; so usually we deploy by below sequences:
1. Deploy Files(upload the files)
1.1 Comment out Dependencies files in manifest.xml. I.e. <!-
1.2 Comment out whole section in deploy.xml. I.e. <!-
1.3 suitecloud project:deploy
2. Deploy Script Records
2.1 Update manifest.xml to enable the dependency for all files section.
2.2 Update deploy.xml to enable the objects section and comment out the
2.3 suitecloud project:deploy