- When calling the Salesforce CLI, always use
sf
. Never use the deprecatedsfdx
or the sfdx-style commands. - Always use an existing Salesforce DX MCP server tool before calling the
sf
CLI.
- Always use an Autonumber fields for all custom objects
- Do not make any custom fields required
- Create a Tab for each custom object
- Always set the custom object as deployed with:
<deploymentStatus>Deployed</deploymentStatus>
- Create a page layout for each custom object and add all custom fields to the layout. Use the following page layout as an example:
<?xml version="1.0" encoding="UTF-8"?>
<Layout xmlns="http://soap.sforce.com/2006/04/metadata">
<excludeButtons>OpenSlackRecordChannel</excludeButtons>
<excludeButtons>Submit</excludeButtons>
<layoutSections>
<customLabel>false</customLabel>
<detailHeading>false</detailHeading>
<editHeading>true</editHeading>
<label>Information</label>
<layoutColumns>
<layoutItems>
<behavior>Readonly</behavior>
<field>Name</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>[custom field]</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>[custom field]</field>
</layoutItems>
</layoutColumns>
<layoutColumns>
<layoutItems>
<behavior>Edit</behavior>
<field>OwnerId</field>
</layoutItems>
</layoutColumns>
<style>TwoColumnsTopToBottom</style>
</layoutSections>
<layoutSections>
<customLabel>false</customLabel>
<detailHeading>false</detailHeading>
<editHeading>true</editHeading>
<label>System Information</label>
<layoutColumns>
<layoutItems>
<behavior>Readonly</behavior>
<field>CreatedById</field>
</layoutItems>
</layoutColumns>
<layoutColumns>
<layoutItems>
<behavior>Readonly</behavior>
<field>LastModifiedById</field>
</layoutItems>
</layoutColumns>
<style>TwoColumnsTopToBottom</style>
</layoutSections>
<layoutSections>
<customLabel>true</customLabel>
<detailHeading>false</detailHeading>
<editHeading>true</editHeading>
<label>Custom Links</label>
<layoutColumns/>
<layoutColumns/>
<layoutColumns/>
<style>CustomLinks</style>
</layoutSections>
<showEmailCheckbox>false</showEmailCheckbox>
<showHighlightsPanel>false</showHighlightsPanel>
<showInteractionLogPanel>false</showInteractionLogPanel>
<showRunAssignmentRulesCheckbox>false</showRunAssignmentRulesCheckbox>
<showSubmitAndAttachButton>false</showSubmitAndAttachButton>
</Layout>
- Always implement Lightning Web Components instead of Aura Components.
- Create only 1 Lighting Web Component for the application.
- Create a Custom Tab for each Flexipage
- Create a Custom Tab for each Custom Object
Use this example of a Flexipage as reference when creating Flexipages.
<?xml version="1.0" encoding="UTF-8"?>
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata">
<flexiPageRegions>
<itemInstances>
<componentInstance>
<componentName>[LWC Component Name]</componentName>
<identifier>[LWC Component Name]Instance</identifier>
</componentInstance>
</itemInstances>
<name>main</name>
<type>Region</type>
</flexiPageRegions>
<masterLabel>[Label for the LWC]</masterLabel>
<template>
<name>flexipage:defaultAppHomeTemplate</name>
</template>
<type>AppPage</type>
</FlexiPage>
- If there is an existing Lightning App, then uses this for the application being build.
- Do not create UtilityBars for Lightning Apps.
- Add all custom object tabs and flexipage custom tabs to this application as tabs.
Use the following as example of a Custom Application as a reference when creating Custom Applications.
<?xml version="1.0" encoding="UTF-8"?>
<CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata">
<brand>
<headerColor>#0070D2</headerColor>
<shouldOverrideOrgTheme>false</shouldOverrideOrgTheme>
</brand>
<formFactors>Small</formFactors>
<formFactors>Large</formFactors>
<isNavAutoTempTabsDisabled>false</isNavAutoTempTabsDisabled>
<isNavPersonalizationDisabled>false</isNavPersonalizationDisabled>
<isNavTabPersistenceDisabled>false</isNavTabPersistenceDisabled>
<isOmniPinnedViewEnabled>false</isOmniPinnedViewEnabled>
<label>Compliment Mixer</label>
<navType>Standard</navType>
<tabs>[Custom Object Tab]</tabs>
<tabs>[Flexipage Tab]</tabs>
<uiType>Lightning</uiType>
</CustomApplication>
-
Before starting the deploy process. Check the rules you were given. Ensure you:
- Did you create a tab for the Custom Ojbect?
- Did you create a tab for the Flexipage?
- Are all of the tabs included in the Custom Application as tabs?
- Does the Permission Set include access to the tab for the custom object?
- Does the Permission Set include access to the tab for the Flexipage?
- Does the Permission provide full access to everything that you built?
-
Before deploying metadata, always run
sf config get target-org
to discover the current default org to deploy metadata to. -
For deploying metadata, you MUST use the Salesforce DX MCP server's
sf-deploy-metadata
tool, not the Salesforce CLI. -
Deploy metadata types in the following order:
- Custom Objects
- Tabs
- Apex Classes
- Triggers
- Lightning Web Components
- Any remaining metadata
-
If the deployment fails, fix any errors and deploy again. Do not proceed to the next type of metadata until the current metadata deploys successfully.
-
After the deployment is complete, ask me if I want to assign the permission set.
Use the existing permission set. Provide full access to any applications, any Apex classes, custom objects and all of their custom fields and any tabs to this permission set.
- Ensure the Permission Set provides access to all tabs.
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<applicationVisibilities>
<application>[Custom Application]</application>
<visible>true</visible>
</applicationVisibilities>
<classAccesses>
<apexClass>[Apex Class]</apexClass>
<enabled>true</enabled>
</classAccesses>
<description>Allows for admins to have full access to metadata for demo.</description>
<fieldPermissions>
<editable>true</editable>
<field>[Custom Object].[field]</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>[Custom Object].[field]</field>
<readable>true</readable>
</fieldPermissions>
<hasActivationRequired>false</hasActivationRequired>
<label>Admin Compliment Mixer Full Access</label>
<objectPermissions>
<allowCreate>true</allowCreate>
<allowDelete>true</allowDelete>
<allowEdit>true</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>true</modifyAllRecords>
<object>[Custom Object]</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<tabSettings>
<tab>[Custom Object]</tab>
<visibility>Visible</visibility>
</tabSettings>
</PermissionSet>
- Do not create tests for Apex classes or Lightning Web Components.
- Do not specify 'visibleLines' for CustomField of type TextArea.
- Do not create a new README.md file. Append any new text to the end of the file.