template Commands
template generate 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/waveTemplatesFlags
- --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:create1analytics generate templatetemplate generate 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 MyClassSimilar 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/classesFlags
- --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:create1apex:generate:classtemplate generate 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 MyTriggerSimilar 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/triggersGenerate 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:create1apex:generate:triggertemplate generate digital-experience site (Developer Preview)
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 mysiteGenerate 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/defaultFlags
- --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)
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 AccountGenerate 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/flexipagesGenerate 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__cFlags
- --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
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 myappSimilar 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/auraFlags
- --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:create1lightning:generate:apptemplate generate lightning 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 mycomponentGenerate a Lightning web component bundle in the current directory:
1sf template generate lightning component --name mycomponent --type lwcGenerate 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/auraGenerate 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/lwcGenerate a TypeScript Lightning Web Component:
1sf template generate lightning component --name mycomponent --type lwc --template typescriptFlags
- --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:create1lightning:generate:componenttemplate generate 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 myeventSimilar 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/auraFlags
- --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:create1lightning:generate:eventtemplate generate 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 myinterfaceSimilar 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/auraFlags
- --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:create1lightning:generate:interfacetemplate generate 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 MyLightningTestSimilar 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/lightningTestsFlags
- --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:create1lightning:generate:testtemplate generate 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 myworkSimilar to previous example, but generate the files in a directory called "myapp":
1sf template generate project --name mywork --default-package-dir myappSimilar to prevoius example, but also generate a default package.xml manifest file:
1sf template generate project --name mywork --default-package-dir myapp --manifestGenerate a project with the minimum files and directories:
1sf template generate project --name mywork --template emptyGenerate a project in which the Lightning Web Components use TypeScript rather than the default JavaScript:
1sf template generate project --name mywork --lwc-language typescriptFlags
- --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:create1project:generatetemplate generate 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 MyResourceSimilar to previous example, but specifies a MIME type of application/json:
1sf template generate static-resource --name MyResource --type application/jsonGenerate the resource file in the "force-app/main/default/staticresources" directory:
1sf template generate static-resource --name MyResource --output-dir force-app/main/default/staticresourcesFlags
- --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:create1static-resource:generatetemplate generate ui-bundle
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 MyUiBundleGenerate a React-based UI bundle:
1sf template generate ui-bundle --name MyReactApp --template reactbasicGenerate 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/uiBundlesFlags
- --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
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 mylabelSimilar 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 componentsFlags
- --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:create1visualforce:generate:componenttemplate generate 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 mylabelSimilar 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 pagesFlags
- --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:create1visualforce:generate:page