How to use NetSuite SDF CLI, CLI for Node.js on Mac, suitecloud command

Installation

  1. 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> <option> <argument>

    Command

    Description

    account:ci

    Set up an account to use with the SuiteCloud CLI for Node.js.

    This command only supports non-interactive mode.

    account:manageauth

    Manages authentication IDs (authid) for all your projects.

    account:setup

    Set up an account to use with the SuiteCloud CLI for Node.js.

    This command only supports interactive mode.

    config:proxy

    Configure a proxy server.

    file:import

    Import files from an account to your account customization project.

    file:list

    Lists the files in the File Cabinet of your account.

    file:upload

    Uploads files from your project to an account.

    object:import

    Import custom objects from an account to your SuiteCloud project.

    object:list

    List the custom objects deployed in an account.

    object:update

    Overwrite the custom objects in the project with the custom objects in an account.

    project:adddependencies

    Adds missing dependencies to the manifest file.

    project:create

    Create a SuiteCloud project, either a SuiteApp or an account customization project (ACP).

    project:deploy

    Deploy the folder containing the project.

    project:package

    Generates a ZIP file from your project, respecting the structure specified in the deploy.xml file, and applying local validation.

    project:validate

    Validate the folder containing the SuiteCloud project.

    suitecommerce:localserver

    Generate a local server of your SuiteCommerce extensions and themes.

 

Sample

  1. 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.

 

  1. suitecloud object:import -i

The following objects have been imported:

- customrecordtype:

- usereventscript:

- Referenced SuiteScript files:

 

  1. suitecloud project:adddependencies
    •   Added dependencies to profile
  2. suitecloud account:setup
    •   Setup login, 2FA, Token, for target NetSuite Account
  3. 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 <space> to select, <a> to toggle all, <i> 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. <!-<file>/SuiteScripts/Project_Name/ScriptFileName.js</file> -->
1.2 Comment out whole section in deploy.xml. I.e. <!-<objects> ../Objects/* </objects> -->
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.

<!-- <files>-->
<!-- <path>~/FileCabinet/*</path>-->
<!-- </files>-->

 

 

#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. <!-<file>/SuiteScripts/Project_Name/ABC_UE_SalesOrder.js</file> -->
1.2 Comment out whole section in deploy.xml. I.e. <!-<objects> ../Objects/* </objects> -->
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 <files> section.
<!--<files> -->
<!--<path>~/FileCabinet/*</path>-->
<!--</files>-->
2.3 suitecloud project:deploy

 

posted @ 2020-11-10 08:24  CarlZeng  阅读(915)  评论(0编辑  收藏  举报