This repository contains FlexiPage templates for use with the Salesforce DX Templates library.
flexipage-templates/
├── README.md (this file)
├── RecordPage/
│ └── _flexipage.flexipage-meta.xml
├── AppPage/
│ └── _flexipage.flexipage-meta.xml
└── HomePage/
└── _flexipage.flexipage-meta.xml
import { TemplateService, TemplateType } from '@salesforce/templates';
const templateService = TemplateService.getInstance();
await templateService.create(
TemplateType.Flexipage,
{
flexipagename: 'Account_Record_Page',
template: 'RecordPage',
flexipageTemplatesGitRepo: 'https://github.com/YOUR_USERNAME/flexipage-templates',
outputdir: './force-app/main/default/flexipages',
apiversion: '61.0',
masterlabel: 'Account Record Page',
description: 'Custom record page for Account object'
}
);sf force:template:create flexipage \
--flexipagename Account_Record_Page \
--template RecordPage \
--flexipage-templates-git-repo https://github.com/YOUR_USERNAME/flexipage-templates \
--outputdir force-app/main/default/flexipages \
--masterlabel "Account Record Page"Standard record page template with a three-column layout.
Best for:
- Object detail pages
- Custom record layouts
- Related lists and highlights panels
Usage:
{
template: 'RecordPage',
flexipagename: 'Custom_Account_Page'
}Application page template with flexible regions.
Best for:
- Utility pages
- Dashboard pages
- Custom app screens
Usage:
{
template: 'AppPage',
flexipagename: 'Sales_Dashboard'
}Home page template with default components.
Best for:
- Custom home pages
- Landing pages
- Overview screens
Usage:
{
template: 'HomePage',
flexipagename: 'Sales_Home'
}All templates support the following EJS variables:
flexipagename- The name of the FlexiPagemasterlabel- The display label (defaults to flexipagename)description- The page descriptionapiVersion- The Salesforce API versiontemplate- The template type (RecordPage, AppPage, or HomePage)
Edit the .flexipage-meta.xml files to add Lightning components:
<flexiPageRegions>
<name>region1</name>
<type>Region</type>
<itemInstances>
<componentInstance>
<componentName>force:recordDetailShortcut</componentName>
<identifier>force_recordDetailShortcut</identifier>
</componentInstance>
</itemInstances>
</flexiPageRegions>- Create a new directory with the template name
- Add a
_flexipage.flexipage-meta.xmlfile - Update the main README with documentation
- Commit and push
<label><%= masterlabel %></label>
<description><%= description %></description><% if (template === 'RecordPage') { %>
<!-- Record-specific components -->
<% } %><componentName>force:record<%= componentType %></componentName>To contribute new templates:
- Fork this repository
- Create a new branch for your template
- Add your template directory with documentation
- Submit a pull request
BSD 3-Clause License - See LICENSE file