file:create

Creates a SuiteScript file of a specified script type in a specified SuiteCloud project, which can be either an Account Customization Project or a SuiteApp.

Syntax

            file:create [-- type]
[--path] 

          

Options

Option

Required / Optional

Description

-- type

Optional

Specifies the script type for the SuiteScript file that you want to create. For example, you can specify the map/reduce script type the following way: --type 'mapReduce'.

For the list of available SuiteScript script types, see SuiteScript 2.x Script Types.

--path

Optional

Specifies the path and filename for the SuiteScript file you are creating. For example, you can specify to create a script in the FileCabinet of a SuiteApp project the following way: --path 'FileCabinet/SuiteApps/com.example.currency/currency.js'

For information about where SuiteScript files can be stored in SuiteCloud projects, see SuiteCloud Project Structure and File Components.

-i or --interactive

Optional

Runs the command in interactive mode.

-h or --help

Optional

Prints the help for this command.

Interactive Example

The following command creates a SuiteScript file using the interactive mode:

            ? What type of SuiteScript do you want to create? (Use arrow keys)
> Bundle Installation Script
  Client Script
  Custom Module
  Custom Plug-in
  Custom Record Action Script
  Map/Reduce Script
  Mass Update Script
  Portlet
  RESTlet
  Scheduled Script
  SDF Installation Script
  Suitelet
  User Event Script
  Workflow Action Script

? Do you want to add SuiteScript modules to the file? (Use arrow keys)
> Yes
  No

? Select the SuiteScript modules you want to add to the SuiteScript file (Press <space> to select, <a> to toggle all, <i> to invert selection)
>( ) N/action
 ( ) N/auth
 ( ) N/cache
 ( ) N/certificateControl
 ( ) N/commerce
 ( ) N/compress
 ( ) N/config
 ( ) N/crypto
 ( ) N/crypto/certificate
 ( ) N/currency
 ( ) N/currentRecord
 ( ) N/dataset
 ( ) N/email
 ( ) N/encode
 ( ) N/error
(Move up and down to reveal more choices)

? Select the folder where you want to create the SuiteScript file (Use arrow keys)
FileCabinet\SuiteApps\com.example.currency\

? Enter a name for the SuiteScript file
commerce.js 

          

Non-Interactive Example

The following command creates a SuiteScript file of type Map/Reduce in the FileCabinet folder of the SDF SuiteApp project using the non-interactive mode:

            suitecloud file:create --type 'mapReduce' --path 'FileCabinet/SuiteApps/com.example.currency/currency.js' 

          

Output Example

When executed, the command produces output that is similar to the following:

            The SuiteScript file was created successfully in C:projects\com.example.currency\currency.js 

          

General Notices