template Commands

Collection of Salesforce templates.

template generate analytics template

Generate a simple Analytics template.

Description for template generate analytics template

The metadata files associated with the Analytics template must be contained in a parent directory called "waveTemplates" in your package directory. Either run this command from an existing directory of this name, or use the --output-dir flag to generate one or point to an existing one.

Examples for template generate analytics template

Generate the metadata files for a simple Analytics template file called myTemplate in the force-app/main/default/waveTemplates directory:

1sf template generate analytics template --name myTemplate --output-dir force-app/main/default/waveTemplates

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option
-n | --name NAME
Required

Name of the Analytics template.

Type: option

Aliases for template generate analytics template

1force:analytics:template:create
1analytics generate template

template generate apex class

Generate an Apex class.

Description for template generate apex class

Generates the Apex *.cls file and associated metadata file. These files must be contained in a parent directory called "classes" in your package directory. Either run this command from an existing directory of this name, or use the --output-dir flag to generate one or point to an existing one.

Examples for template generate apex class

Generate two metadata files associated with the MyClass Apex class (MyClass.cls and MyClass.cls-meta.xml) in the current directory:

1sf template generate apex class --name MyClass

Similar to previous example, but generates the files in the "force-app/main/default/classes" directory:

1sf template generate apex class --name MyClass --output-dir force-app/main/default/classes

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated Apex class.

The name can be up to 40 characters and must start with a letter.

Type: option
-t | --template TEMPLATE
Optional

Template to use for file creation.

Supplied parameter values or default values are filled into a copy of the template.

Type: option
Permissible values are: ApexException, ApexUnitTest, BasicUnitTest, DefaultApexClass, InboundEmailService
Default value: DefaultApexClass
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option

Aliases for template generate apex class

1force:apex:class:create
1apex:generate:class

template generate apex trigger

Generate an Apex trigger.

Description for template generate apex trigger

Generates the Apex trigger *.trigger file and associated metadata file. These files must be contained in a parent directory called "triggers" in your package directory. Either run this command from an existing directory of this name, or use the --output-dir flag to generate one or point to an existing one.

If you don't specify the --sobject flag, the .trigger file contains the generic placeholder SOBJECT; replace it with the Salesforce object you want to generate a trigger for. If you don't specify --event, "before insert" is used.

Examples for template generate apex trigger

Generate two files associated with the MyTrigger Apex trigger (MyTrigger.trigger and MyTrigger.trigger-meta.xml) in the current directory:

1sf template generate apex trigger --name MyTrigger

Similar to the previous example, but generate the files in the "force-app/main/default/triggers" directory:

1sf template generate apex trigger --name MyTrigger --output-dir force-app/main/default/triggers

Generate files for a trigger that fires on the Account object before and after an insert:

1sf template generate apex trigger --name MyTrigger --sobject Account --event "before insert,after insert"

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated Apex trigger

The name can be up to 40 characters and must start with a letter.

Type: option
-t | --template TEMPLATE
Optional

Template to use for file creation.

Supplied parameter values or default values are filled into a copy of the template.

Type: option
Permissible values are: ApexTrigger
Default value: ApexTrigger
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option
-s | --sobject SOBJECT
Optional

Salesforce object to generate a trigger on.

Type: option
Default value: SOBJECT
-e | --event EVENT
Optional

Events that fire the trigger.

Type: option
Permissible values are: before insert, before update, before delete, after insert, after update, after delete, after undelete
Default value: before insert

Aliases for template generate apex trigger

1force:apex:trigger:create
1apex:generate:trigger

template generate digital-experience site (Developer Preview)

Generate an Experience Cloud site.

This command is available as a developer preview. The command isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Don't implement functionality developed with these commands or tools.

Note

Description for template generate digital-experience site

Creates the metadata of an Experience Cloud site with the specified template, name, and URL path prefix. The output includes all the necessary metadata files, including DigitalExperienceConfig, DigitalExperienceBundle, Network, and CustomSite.

Unlike `sf community create`, which builds the site directly in the org, this command generates only the local metadata.

Examples for template generate digital-experience site

Generate an Experience Cloud site using the Build Your Own (LWR) template. The site is called "mysite" and has the URL path prefix "mysite":

1sf template generate digital-experience site --template-name "Build Your Own (LWR)" --name mysite --url-path-prefix mysite

Generate an Experience Cloud site like the last example, but generate the files into the specified output directory:

1sf template generate digital-experience site --template-name "Build Your Own (LWR)" --name mysite --url-path-prefix mysite --output-dir force-app/main/default

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-o | --target-org TARGET-ORG
Optional

Username or alias of the target org.

Type: option
-n | --name NAME
Required

Name of the Experience Cloud site to generate.

Type: option
-t | --template-name TEMPLATE-NAME
Required

Template to use when generating the site.

Type: option
Permissible values are: Build Your Own (LWR)
-p | --url-path-prefix URL-PATH-PREFIX
Optional

URL path prefix for the site; must contain only alphanumeric characters.

Type: option
-e | --admin-email ADMIN-EMAIL
Optional

Email address for the site administrator. Defaults to the username of the currently authenticated user.

Type: option
-d | --output-dir OUTPUT-DIR
Optional

Directory to generate the site files in.

The location can be an absolute path or relative to the current working directory. If not specified, the command reads your sfdx-project.json file and uses the default package directory. When running outside a Salesforce DX project, defaults to the current directory.

Type: option

template generate flexipage (Beta)

Generate a FlexiPage, also known as a Lightning page.

This feature is a Beta Service. Customers may opt to try such Beta Service in its sole discretion. Any use of the Beta Service is subject to the applicable Beta Services Terms provided at Agreements and Terms (https://www.salesforce.com/company/legal/agreements/).

Note

Description for template generate flexipage

FlexiPages are the metadata types associated with a Lightning page. A Lightning page represents a customizable screen made up of regions containing Lightning components.

You can use this command to generate these types of FlexiPages; specify the type with the --template flag:

- AppPage: A Lightning page used as the home page for a custom app or a standalone application page.

- HomePage: A Lightning page used to override the Home page in Lightning Experience.

- RecordPage: A Lightning page used to override an object record page in Lightning Experience. Requires that you specify the object name with the --sobject flag.

Examples for template generate flexipage

Generate a RecordPage FlexiPage for the Account object in the current directory:

1sf template generate flexipage --name Account_Record_Page --template RecordPage --sobject Account

Generate an AppPage FlexiPage in the "force-app/main/default/flexipages" directory:

1sf template generate flexipage --name Sales_Dashboard --template AppPage --output-dir force-app/main/default/flexipages

Generate a HomePage FlexiPage with a custom label:

1sf template generate flexipage --name Custom_Home --template HomePage --label "Sales Home Page"

Generate a RecordPage with dynamic highlights and detail fields:

1sf template generate flexipage --name Property_Page --template RecordPage --sobject Rental_Property__c --primary-field Name --secondary-fields Property_Address__c,City__c --detail-fields Name,Property_Address__c,City__c,Monthly_Rent__c,Bedrooms__c

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the FlexiPage.

The name can contain only alphanumeric characters, must start with a letter, and can't end with an underscore or contain two consecutive underscores.

Type: option
-t | --template TEMPLATE
Required

Template type for the FlexiPage.

Type: option
Permissible values are: RecordPage, AppPage, HomePage
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option
--label LABEL
Optional

Label of this FlexiPage; if not specified, uses the FlexiPage name as the label.

Type: option
--description DESCRIPTION
Optional

Description for the FlexiPage, which provides context about its purpose.

Type: option
-s | --sobject SOBJECT
Optional

API name of the Salesforce object; required when creating a RecordPage.

For RecordPage FlexiPages, you must specify the associated object API name, such as 'Account', 'Opportunity', or 'Custom_Object__c'. This sets the `sobjectType` field in the FlexiPage metadata.

Type: option
--primary-field PRIMARY-FIELD
Optional

Primary field for the dynamic highlights header; typically 'Name'. Used only with RecordPage.

Type: option
--secondary-fields SECONDARY-FIELDS
Optional

Secondary fields shown in the dynamic highlights header. Specify multiple fields separated by commas. Maximum of 11 fields. Used only with RecordPage.

Type: option
--detail-fields DETAIL-FIELDS
Optional

Fields to display in the Details tab. Specify multiple fields separated by commas. Fields are split into two columns. Used only with RecordPage.

Type: option

template generate lightning app

Generate a Lightning App.

Description for template generate lightning app

Generates a Lightning App bundle in the specified directory or the current working directory. The bundle consists of multiple files in a folder with the designated name.

Examples for template generate lightning app

Generate the metadata files for a Lightning app bundle called "myapp" in the current directory:

1sf template generate lightning app --name myapp

Similar to the previous example, but generate the files in the "force-app/main/default/aura" directory:

1sf template generate lightning app --name myapp --output-dir force-app/main/default/aura

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated Lightning App.

The name can be up to 40 characters and must start with a letter.

Type: option
-t | --template TEMPLATE
Optional

Template to use for file creation.

Supplied parameter values or default values are filled into a copy of the template. For Lightning Web Components, if this flag isn't specified, the CLI command automatically selects the template based on the "defaultLwcLanguage" field in the DX project's "sfdx-project.json" file.

Type: option
Permissible values are: DefaultLightningApp
Default value: DefaultLightningApp
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option

Aliases for template generate lightning app

1force:lightning:app:create
1lightning:generate:app

template generate lightning component

Generate a bundle for an Aura component or a Lightning web component.

Description for template generate lightning component

Generates the bundle in the specified directory or the current working directory. The bundle consists of multiple files in a directory with the designated name. Lightning web components are contained in the directory with name "lwc", Aura components in "aura".

To generate a Lightning web component, pass "--type lwc" to the command. If you don’t specify --type, Salesforce CLI generates an Aura component by default.

Examples for template generate lightning component

Generate the metadata files for an Aura component bundle in the current directory:

1sf template generate lightning component --name mycomponent

Generate a Lightning web component bundle in the current directory:

1sf template generate lightning component --name mycomponent --type lwc

Generate an Aura component bundle in the "force-app/main/default/aura" directory:

1sf template generate lightning component --name mycomponent --output-dir force-app/main/default/aura

Generate a Lightning web component bundle in the "force-app/main/default/lwc" directory:

1sf template generate lightning component --name mycomponent --type lwc --output-dir force-app/main/default/lwc

Generate a TypeScript Lightning Web Component:

1sf template generate lightning component --name mycomponent --type lwc --template typescript

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated Lightning Component.

The name can be up to 40 characters and must start with a letter.

Type: option
-t | --template TEMPLATE
Optional

Template to use for file creation.

Supplied parameter values or default values are filled into a copy of the template. For Lightning Web Components, if this flag isn't specified, the CLI command automatically selects the template based on the "defaultLwcLanguage" field in the DX project's "sfdx-project.json" file.

Type: option
Permissible values are: default, analyticsDashboard, analyticsDashboardWithStep, typescript
Default value: default
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option
--type TYPE
Optional

Type of the component bundle.

Type: option
Permissible values are: aura, lwc
Default value: aura

Aliases for template generate lightning component

1force:lightning:component:create
1lightning:generate:component

template generate lightning event

Generate a Lightning Event.

Description for template generate lightning event

Generates a Lightning Event bundle in the specified directory or the current working directory. The bundle consists of multiple files in a folder with the designated name.

Examples for template generate lightning event

Generate the metadata files for a Lightning event bundle called "myevent" in the current directory:

1sf template generate lightning event --name myevent

Similar to previous example, but generate the files in the "force-app/main/default/aura" directory:

1sf template generate lightning event --name myevent --output-dir force-app/main/default/aura

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated Lightning Event.

The name can be up to 40 characters and must start with a letter.

Type: option
-t | --template TEMPLATE
Optional

Template to use for file creation.

Supplied parameter values or default values are filled into a copy of the template. For Lightning Web Components, if this flag isn't specified, the CLI command automatically selects the template based on the "defaultLwcLanguage" field in the DX project's "sfdx-project.json" file.

Type: option
Permissible values are: DefaultLightningEvt
Default value: DefaultLightningEvt
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option

Aliases for template generate lightning event

1force:lightning:event:create
1lightning:generate:event

template generate lightning interface

Generate a Lightning Interface.

Description for template generate lightning interface

Generates a Lightning Interface bundle in the specified directory or the current working directory. The bundle consists of multiple files in a folder with the designated name.

Examples for template generate lightning interface

Generate the metadata files for a Lightning interface bundle called "myinterface" in the current directory:

1sf template generate lightning interface --name myinterface

Similar to the previous example but generate the files in the "force-app/main/default/aura" directory:

1sf template generate lightning interface --name myinterface --output-dir force-app/main/default/aura

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated Lightning Interface.

The name can be up to 40 characters and must start with a letter.

Type: option
-t | --template TEMPLATE
Optional

Template to use for file creation.

Supplied parameter values or default values are filled into a copy of the template. For Lightning Web Components, if this flag isn't specified, the CLI command automatically selects the template based on the "defaultLwcLanguage" field in the DX project's "sfdx-project.json" file.

Type: option
Permissible values are: DefaultLightningIntf
Default value: DefaultLightningIntf
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option

Aliases for template generate lightning interface

1force:lightning:interface:create
1lightning:generate:interface

template generate lightning test

Generate a Lightning test.

Description for template generate lightning test

Generates the test in the specified directory or the current working directory. The .resource file and associated metadata file are generated.

Examples for template generate lightning test

Generate the metadata files for the Lightning test called MyLightningTest in the current directory:

1sf template generate lightning test --name MyLightningTest

Similar to the previous example but generate the files in the "force-app/main/default/lightningTests" directory:

1sf template generate lightning test --name MyLightningTest --output-dir force-app/main/default/lightningTests

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated Lightning Test.

Name of the new Lightning test; can be up to 40 characters and must start with a letter.

Type: option
-t | --template TEMPLATE
Optional

Template to use for file creation.

Supplied parameter values or default values are filled into a copy of the template. For Lightning Web Components, if this flag isn't specified, the CLI command automatically selects the template based on the "defaultLwcLanguage" field in the DX project's "sfdx-project.json" file.

Type: option
Permissible values are: DefaultLightningTest
Default value: DefaultLightningTest
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option

Aliases for template generate lightning test

1force:lightning:test:create
1lightning:generate:test

template generate project

Generate a Salesforce DX project.

Description for template generate project

A Salesforce DX project has a specific structure and a configuration file (sfdx-project.json) that identifies the directory as a Salesforce DX project. This command generates the necessary configuration files and directories to get you started.

By default, the generated sfdx-project.json file sets the sourceApiVersion property to the default API version currently used by Salesforce CLI. To specify a different version, set the apiVersion configuration variable. For example: "sf config set apiVersion=57.0 --global".

Examples for template generate project

Generate a project called "mywork":

1sf template generate project --name mywork

Similar to previous example, but generate the files in a directory called "myapp":

1sf template generate project --name mywork --default-package-dir myapp

Similar to prevoius example, but also generate a default package.xml manifest file:

1sf template generate project --name mywork --default-package-dir myapp --manifest

Generate a project with the minimum files and directories:

1sf template generate project --name mywork --template empty

Generate a project in which the Lightning Web Components use TypeScript rather than the default JavaScript:

1sf template generate project --name mywork --lwc-language typescript

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated project.

Generates a project directory with this name; any valid directory name is accepted. Also sets the "name" property in the sfdx-project.json file to this name.

Type: option
-t | --template TEMPLATE
Optional

Template to use for project creation.

The template determines the sample configuration files and directories that this command generates. For example, the empty template provides these files and directory to get you started.

- .forceignore

- config/project-scratch-def.json

- sfdx-project.json

- package.json

- force-app (basic source directory structure)

The standard template provides a complete force-app directory structure so you know where to put your source. It also provides additional files and scripts, especially useful when using Salesforce Extensions for VS Code. For example:

- .gitignore: Use Git for version control.

- .prettierrc and .prettierignore: Use Prettier to format your Aura components.

- .vscode/extensions.json: When launched, Visual Studio Code, prompts you to install the recommended extensions for your project.

- .vscode/launch.json: Configures Replay Debugger.

- .vscode/settings.json: Additional configuration settings.

The analytics template provides similar files and the force-app/main/default/waveTemplates directory.

The reactinternalapp and reactexternalapp templates provide React-based project scaffolding for internal and external UI bundle use cases.

The agent template provides project scaffolding for building Agentforce agents and includes a sample agent called Local Info Agent.

Type: option
Permissible values are: standard, empty, analytics, reactinternalapp, reactexternalapp, agent
Default value: standard
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
-s | --namespace NAMESPACE
Optional

Namespace associated with this project and any connected scratch orgs.

Type: option
-p | --default-package-dir DEFAULT-PACKAGE-DIR
Optional

Default package directory name.

Metadata items such as classes and Lightning bundles are placed inside this folder.

Type: option
Default value: force-app
-x | --manifest
Optional

Generate a manifest (package.xml) for change-set based development.

Generates a default manifest (package.xml) for fetching Apex, Visualforce, Lightning components, and static resources.

Type: boolean
--lwc-language LWC-LANGUAGE
Optional

Language of the Lightning Web Components. If not specified, "javascript" is used.

When set to `'typescript'`, generates TypeScript configuration files (tsconfig.json, package.json with TypeScript dependencies, and TypeScript-aware ESLint config). When you deploy the TypeScript-based Lightning Web Components, the TypeScript files are first compiled locally for validation and then the `.ts` files are deployed to your org for server-side type stripping.

Type: option
Permissible values are: javascript, typescript
--api-version API-VERSION
Optional

Will set this version as sourceApiVersion in the sfdx-project.json file

Override the api version used for api requests made by this command

Type: option

Aliases for template generate project

1force:project:create
1project:generate

template generate static-resource

Generate a static resource.

Description for template generate static-resource

Generates the metadata resource file in the specified directory or the current working directory. Static resource files must be contained in a parent directory called "staticresources" in your package directory. Either run this command from an existing directory of this name, or use the --output-dir flag to create one or point to an existing one.

Examples for template generate static-resource

Generate the metadata file for a static resource called MyResource in the current directory:

1sf template generate static-resource --name MyResource

Similar to previous example, but specifies a MIME type of application/json:

1sf template generate static-resource --name MyResource --type application/json

Generate the resource file in the "force-app/main/default/staticresources" directory:

1sf template generate static-resource --name MyResource --output-dir force-app/main/default/staticresources

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated static resource.

This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.

Type: option
--type TYPE
Optional

Content type (mime type) of the generated static resource.

Must be a valid MIME type such as application/json, application/javascript, application/zip, text/plain, text/css, etc.

Type: option
Default value: application/zip
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option

Aliases for template generate static-resource

1force:staticresource:create
1static-resource:generate

template generate ui-bundle

Generate a UI bundle, which contains the code and metadata to build a UI experience that uses non-native Salesforce frameworks, such as React.

Description for template generate ui-bundle

Salesforce provides native UI frameworks, such as Lighting Web Components (LWC), to build applications that run on the Salesforce Platform. But you can also use non-native JavaScript- or TypeScript-based UI frameworks, such as React, to build a UI experience for the Salesforce Platform and that you can launch from the App Launcher.

These non-native UI experiences are defined by the "UIBundle" metadata type in your DX project. Use this command to generate the required DX project structure and files. For example, when you run this command and specify the name MyUiBundle, then the files are generated into a "uiBundles/MyUiBundle" directory. Use the --output-dir flag to specify a different directory.

Use the --template flag for generating the files to get started with a speciic UI framework, such as React. Check out the README.md file in the generated "uiBundles/<bundlename>" directory for more information about the template.

Examples for template generate ui-bundle

Generate a UI bundle called MyUiBundle in the current directory:

1sf template generate ui-bundle --name MyUiBundle

Generate a React-based UI bundle:

1sf template generate ui-bundle --name MyReactApp --template reactbasic

Generate the React-based UI bundle in the "force-app/main/default/uiBundles" directory:

1sf template generate ui-bundle --name MyUiBundle --template reactbasic --output-dir force-app/main/default/uiBundles

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

API name of the generated UI bundle.

This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.

Type: option
-t | --template TEMPLATE
Optional

Template to use when creating the files for a specific UI framework.

Supplied parameter values or default values are filled into a copy of the template.

Type: option
Permissible values are: default, reactbasic
Default value: default
-l | --label LABEL
Optional

Master label for the UI bundle.

If not specified, the label is derived from the name.

Type: option
-d | --output-dir OUTPUT-DIR
Optional

Directory into which the files are created.

The location can be an absolute path or relative to the current working directory.

If not specified, the command reads your sfdx-project.json and defaults to "uiBundles" directory within your default package directory. When running outside a Salesforce DX project, defaults to the current directory.

**Important:** This command automatically ensures the output directory ends with "uiBundles". If your specified path doesn't end with "uiBundles", it's automatically appended. The UI bundle is created at "<output-dir>/<name>".

**Examples:**

- "--output-dir force-app/main/default" → Creates a UI bundle at "force-app/main/default/uiBundles/MyUiBundle/"

- "--output-dir force-app/main/default/uiBundles" → Creates a UI bundle at "force-app/main/default/uiBundles/MyUiBundle/" (no change)

Type: option
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option

template generate visualforce component

Generate a Visualforce Component.

Description for template generate visualforce component

The command generates the .Component file and associated metadata file in the specified directory or the current working directory by default.

Examples for template generate visualforce component

Generate the metadata files for a Visualforce component in the current directory:

1sf template generate visualforce component --name mycomponent --label mylabel

Similar to previous example, but generate the files in the directory "force-app/main/default/components":

1sf template generate visualforce component --name mycomponent --label mylabel --output-dir components

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated Visualforce Component.

The name can be up to 40 characters and must start with a letter.

Type: option
-t | --template TEMPLATE
Optional

Template to use for file creation.

Supplied parameter values or default values are filled into a copy of the template.

Type: option
Permissible values are: DefaultVFComponent
Default value: DefaultVFComponent
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option
-l | --label LABEL
Required

Visualforce Component label.

Type: option

Aliases for template generate visualforce component

1force:visualforce:component:create
1visualforce:generate:component

template generate visualforce page

Generate a Visualforce Page.

Description for template generate visualforce page

The command generates the .Page file and associated metadata file in the specified directory or the current working directory by default.

Examples for template generate visualforce page

Generate the metadata files for a Visualforce page in the current directory:

1sf template generate visualforce page --name mypage --label mylabel

Similar to previous example, but generate the files in the directory "force-app/main/default/pages":

1sf template generate visualforce page --name mypage --label mylabel --output-dir pages

Flags

--json
Optional

Format output as json.

Type: boolean
--flags-dir FLAGS-DIR
Optional

Import flag values from a directory.

Type: option
-n | --name NAME
Required

Name of the generated Visualforce Page.

The name can be up to 40 characters and must start with a letter.

Type: option
-d | --output-dir OUTPUT-DIR
Optional

Directory for saving the created files.

The location can be an absolute path or relative to the current working directory. The default is the current directory.

Type: option
Default value: .
--api-version API-VERSION
Optional

Override the api version used for api requests made by this command

Type: option
-l | --label LABEL
Required

Visualforce Page label.

Type: option

Aliases for template generate visualforce page

1force:visualforce:page:create
1visualforce:generate:page