---
schema_version: "1"
id: b562e96d2da1283132801dc5bf730a4c1785b0416ae65dec8078145075787bc8
title: template generate flexipage (Beta)
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/template/cli_reference_template_generate_flexipage.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_template_generate_flexipage.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8b169e922048e1b5fe5443a26df50a18c3d6ca754a9b6929fdbd0ee0f52a1828
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# template generate flexipage (Beta)

Generate a FlexiPage, also known as a Lightning page.

**note:** 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/).

## 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:

<ul><li>AppPage: A Lightning page used as the home page for a custom app or a standalone application page.</li><li>HomePage: A Lightning page used to override the Home page in Lightning Experience.</li><li>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.</li></ul>

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;api&#8209;version</code> | N/A | **Type:** Value<br><br>Override the api version used for api requests made by this command |
| <code>&#8209;&#8209;description</code> | N/A | **Type:** Value<br><br>Description for the FlexiPage, which provides context about its purpose. |
| <code>&#8209;&#8209;detail&#8209;fields</code> | N/A | **Type:** Value<br><br>Fields to display in the Details tab. Specify multiple fields separated by commas. Fields are split into two columns. Used only with RecordPage. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;label</code> | N/A | **Type:** Value<br><br>Label of this FlexiPage; if not specified, uses the FlexiPage name as the label. |
| <code>&#8209;&#8209;name</code> | <code>&#8209;n</code> | **Type:** Value<br>**Required**<br><br>Name of the FlexiPage.<br><br>The name can contain only alphanumeric characters, must start with a letter, and can't end with an underscore or contain two consecutive underscores. |
| <code>&#8209;&#8209;output&#8209;dir</code> | <code>&#8209;d</code> | **Type:** Value<br>**Default value:** `.`<br><br>Directory for saving the created files.<br><br>The location can be an absolute path or relative to the current working directory. The default is the current directory. |
| <code>&#8209;&#8209;primary&#8209;field</code> | N/A | **Type:** Value<br><br>Primary field for the dynamic highlights header; typically 'Name'. Used only with RecordPage. |
| <code>&#8209;&#8209;secondary&#8209;fields</code> | N/A | **Type:** Value<br><br>Secondary fields shown in the dynamic highlights header. Specify multiple fields separated by commas. Maximum of 11 fields. Used only with RecordPage. |
| <code>&#8209;&#8209;sobject</code> | <code>&#8209;s</code> | **Type:** Value<br><br>API name of the Salesforce object; required when creating a RecordPage.<br><br>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. |
| <code>&#8209;&#8209;template</code> | <code>&#8209;t</code> | **Type:** Value<br>**Required**<br>**Valid Values:** `RecordPage`, `AppPage`, `HomePage`<br><br>Template type for the FlexiPage. |

## Examples for template generate flexipage

Generate a RecordPage FlexiPage for the Account object in the current directory:

```shell
sf template generate flexipage --name Account_Record_Page --template RecordPage --sobject Account
```

Generate an AppPage FlexiPage in the "force-app/main/default/flexipages" directory:

```shell
sf template generate flexipage --name Sales_Dashboard --template AppPage --output-dir force-app/main/default/flexipages
```

Generate a HomePage FlexiPage with a custom label:

```shell
sf template generate flexipage --name Custom_Home --template HomePage --label "Sales Home Page"
```

Generate a RecordPage with dynamic highlights and detail fields:

```shell
sf 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
```
<!-- prettier-ignore-end -->
