
Sf Schema
- 41 installs
- 12 repo stars
- Updated July 14, 2026
- clientell-ai/salesforce-skills
Generate and validate Salesforce custom field, formula, and object metadata XML when extending a CRM-backed app or sync layer.
About
sf-schema is an agent skill that equips solo builders and small teams with Salesforce Metadata API–style XML fragments for custom fields and formulas. When you extend Leads, Opportunities, or custom objects, agents often hallucinate invalid field types, wrong blank-handling, or broken cross-object syntax—this skill anchors generation to concrete patterns for text, number, and date formulas, renewal-date logic, and CASE-driven scoring. It fits builders shipping SaaS with Salesforce as system of record, RevOps automations, or sync services that must deploy metadata through CI. Use it while modeling fields in build, before packaging changes for ship, not as a substitute for org-specific validation rules or full object XML. Pair with your deployment toolchain and org documentation so generated XML matches your namespacing and API version.
- Copy-paste XML patterns for Text, Number, and Date formula fields with formulaTreatBlanksAs
- Cross-object formula examples using relationship traversal (e.g. Account__r.Industry)
- CASE, IF, and ISBLANK formula snippets for priority and scoring fields
- Precision, scale, and externalId flags aligned to Salesforce field-type rules
- Reference-oriented snippets for common custom-field metadata blocks
Sf Schema by the numbers
- 41 all-time installs (skills.sh)
- Ranked #3,278 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/clientell-ai/salesforce-skills --skill sf-schemaAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 41 |
|---|---|
| repo stars | ★ 12 |
| Security audit | 3 / 3 scanners passed |
| Last updated | July 14, 2026 |
| Repository | clientell-ai/salesforce-skills ↗ |
What it does
Generate and validate Salesforce custom field, formula, and object metadata XML when extending a CRM-backed app or sync layer.
Files
Schema Design & Permission Management
You are a Salesforce schema and metadata specialist. Generate valid SFDX source format metadata.
Custom Object
<!-- force-app/main/default/objects/Invoice__c/Invoice__c.object-meta.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Invoice</label>
<pluralLabel>Invoices</pluralLabel>
<nameField>
<label>Invoice Number</label>
<type>AutoNumber</type>
<displayFormat>INV-{000000}</displayFormat>
</nameField>
<deploymentStatus>Deployed</deploymentStatus>
<sharingModel>Private</sharingModel>
<enableActivities>true</enableActivities>
<enableHistory>true</enableHistory>
<enableReports>true</enableReports>
</CustomObject>Custom Fields
<!-- force-app/main/default/objects/Invoice__c/fields/Amount__c.field-meta.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Amount__c</fullName>
<label>Amount</label>
<type>Currency</type>
<precision>18</precision>
<scale>2</scale>
<required>true</required>
</CustomField>Common Field Types
<!-- Text -->
<type>Text</type>
<length>255</length>
<!-- Long Text Area -->
<type>LongTextArea</type>
<length>32768</length>
<visibleLines>5</visibleLines>
<!-- Picklist -->
<type>Picklist</type>
<valueSet>
<restricted>true</restricted>
<valueSetDefinition>
<sorted>false</sorted>
<value><fullName>Active</fullName><default>true</default><label>Active</label></value>
<value><fullName>Inactive</fullName><default>false</default><label>Inactive</label></value>
</valueSetDefinition>
</valueSet>
<!-- Lookup -->
<type>Lookup</type>
<referenceTo>Account</referenceTo>
<relationshipLabel>Invoices</relationshipLabel>
<relationshipName>Invoices</relationshipName>
<!-- Master-Detail -->
<type>MasterDetail</type>
<referenceTo>Account</referenceTo>
<relationshipLabel>Invoices</relationshipLabel>
<relationshipName>Invoices</relationshipName>
<reparentableMasterDetail>false</reparentableMasterDetail>
<writeRequiresMasterRead>false</writeRequiresMasterRead>
<!-- Checkbox -->
<type>Checkbox</type>
<defaultValue>false</defaultValue>
<!-- Date -->
<type>Date</type>
<!-- DateTime -->
<type>DateTime</type>
<!-- Number -->
<type>Number</type>
<precision>18</precision>
<scale>0</scale>
<!-- Formula -->
<type>Text</type>
<formula>Account__r.Name & ' - ' & TEXT(Amount__c)</formula>Validation Rules
<!-- force-app/main/default/objects/Invoice__c/validationRules/Amount_Required.validationRule-meta.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<ValidationRule xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Amount_Must_Be_Positive</fullName>
<active>true</active>
<errorConditionFormula>Amount__c <= 0</errorConditionFormula>
<errorDisplayField>Amount__c</errorDisplayField>
<errorMessage>Amount must be greater than zero.</errorMessage>
</ValidationRule>Permission Sets
<!-- force-app/main/default/permissionsets/Invoice_Manager.permissionset-meta.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Invoice Manager</label>
<hasActivationRequired>false</hasActivationRequired>
<objectPermissions>
<object>Invoice__c</object>
<allowCreate>true</allowCreate>
<allowDelete>false</allowDelete>
<allowEdit>true</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>false</modifyAllRecords>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<fieldPermissions>
<field>Invoice__c.Amount__c</field>
<editable>true</editable>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Invoice__c.Status__c</field>
<editable>true</editable>
<readable>true</readable>
</fieldPermissions>
</PermissionSet>Custom Permissions (for Flow Bypass)
<!-- force-app/main/default/customPermissions/Bypass_Automation.customPermission-meta.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<CustomPermission xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Bypass Automation</label>
<isLicensed>false</isLicensed>
</CustomPermission>Additional Field Types
Formula Field:
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>FullName__c</fullName>
<label>Full Name</label>
<type>Text</type>
<formula>FirstName__c & ' ' & LastName__c</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
</CustomField>Rollup Summary Field (master-detail only):
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Total_Amount__c</fullName>
<label>Total Amount</label>
<type>Summary</type>
<summarizedField>LineItem__c.Amount__c</summarizedField>
<summaryOperation>sum</summaryOperation>
<summaryForeignKey>LineItem__c.Order__c</summaryForeignKey>
</CustomField>Geolocation Field:
<type>Location</type>
<displayLocationInDecimal>true</displayLocationInDecimal>
<scale>6</scale>Global Value Set (Reusable Picklist):
<GlobalValueSet xmlns="http://soap.sforce.com/2006/04/metadata">
<masterLabel>Industries</masterLabel>
<sorted>false</sorted>
<customValue><fullName>Technology</fullName><default>false</default><label>Technology</label></customValue>
<customValue><fullName>Healthcare</fullName><default>false</default><label>Healthcare</label></customValue>
</GlobalValueSet>Relationship Types
| Type | Delete Behavior | Rollup Summary | Reparenting | Max per Object |
|---|---|---|---|---|
| Master-Detail | Cascade delete | Yes | Configurable | 2 |
| Lookup | Block/Clear/Restrict | No | N/A | 40 (25 std) |
| External Lookup | N/A | No | N/A | - |
| Hierarchical | N/A | No | N/A | 1 (User only) |
| Junction (M2M) | Two master-details | On both parents | - | - |
Record Types
<RecordType xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Enterprise</fullName>
<label>Enterprise</label>
<active>true</active>
<businessProcess>Enterprise Sales Process</businessProcess>
<description>For enterprise accounts</description>
</RecordType>Custom Metadata Types vs Custom Settings
| Feature | Custom Metadata Types | Custom Settings (Hierarchy) |
|---|---|---|
| Deployable | Yes (metadata) | No (data) |
| SOQL required | Yes (or getInstance) | No (getOrgDefaults) |
| User/Profile override | No | Yes |
| Counts against SOQL limit | Yes | No |
| Use for | Org config, mappings | User preferences |
Permission Set Groups
<PermissionSetGroup xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Sales Team</label>
<permissionSets>
<permissionSet>Account_Manager</permissionSet>
<permissionSet>Opportunity_Editor</permissionSet>
<permissionSet>Report_Viewer</permissionSet>
</permissionSets>
</PermissionSetGroup>SFDX Source Directory Structure
force-app/main/default/
├── objects/
│ └── Invoice__c/
│ ├── Invoice__c.object-meta.xml
│ ├── fields/
│ │ ├── Amount__c.field-meta.xml
│ │ └── Status__c.field-meta.xml
│ ├── validationRules/
│ │ └── Amount_Must_Be_Positive.validationRule-meta.xml
│ └── listViews/
│ └── All.listView-meta.xml
├── permissionsets/
│ └── Invoice_Manager.permissionset-meta.xml
├── customPermissions/
│ └── Bypass_Automation.customPermission-meta.xml
└── layouts/
└── Invoice__c-Invoice Layout.layout-meta.xmlGotchas
- Max 40 custom relationships per object (25 for standard objects)
- Formula fields cannot reference LongTextArea, RichTextArea, MultiSelectPicklist, or Encrypted fields
- Rollup Summary fields work only on Master-Detail relationships — not Lookups
- Global Value Sets cannot be converted back to local picklists once shared
- Encrypted Text fields are not searchable or sortable
- Record type-dependent picklists require explicit value mapping per record type
- Permission Set Groups recalculate asynchronously — changes may take minutes to apply
- Custom Metadata Type records cannot be created/updated via DML in production — deploy only
- Profiles are notoriously merge-conflict-prone — prefer Permission Sets for everything
References
- Schema Reference — formula fields, rollup summaries, geolocation, Global Value Sets, record types, page layouts, FlexiPages, custom metadata, platform events, Big Objects, quick actions, custom labels
Workflow
1. Understand object/field requirements 2. Generate SFDX source format XML files 3. Generate permission set for new objects/fields 4. Deploy schema first, then code that references it 5. Verify with: sf org list metadata -m CustomObject --target-org myOrg
Salesforce Schema Metadata XML Reference
1. Formula Field
Text Formula
<fields>
<fullName>Full_Name__c</fullName>
<label>Full Name</label>
<type>Text</type>
<formula>FirstName & " " & LastName</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
<externalId>false</externalId>
<required>false</required>
</fields>Number Formula
<fields>
<fullName>Discount_Amount__c</fullName>
<label>Discount Amount</label>
<type>Number</type>
<precision>18</precision>
<scale>2</scale>
<formula>Amount__c * Discount_Percent__c / 100</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
</fields>Date Formula
<fields>
<fullName>Renewal_Date__c</fullName>
<label>Renewal Date</label>
<type>Date</type>
<formula>ADDMONTHS(Start_Date__c, Contract_Length__c)</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
</fields>Cross-Object Formula
<fields>
<fullName>Account_Industry__c</fullName>
<label>Account Industry</label>
<type>Text</type>
<formula>Account__r.Industry</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
</fields>CASE / IF / ISBLANK Functions
<fields>
<fullName>Priority_Score__c</fullName>
<label>Priority Score</label>
<type>Number</type>
<precision>3</precision>
<scale>0</scale>
<formula>
CASE(Priority,
"High", 3,
"Medium", 2,
"Low", 1,
0
)
+
IF(ISBLANK(Email), 0, 1)
</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
</fields>---
2. Rollup Summary Field
SUM Rollup
<fields>
<fullName>Total_Amount__c</fullName>
<label>Total Amount</label>
<summarizedField>Opportunity.Amount</summarizedField>
<summaryFilterItems>
<field>Opportunity.StageName</field>
<operation>notEqual</operation>
<value>Closed Lost</value>
</summaryFilterItems>
<summaryForeignKey>Opportunity.AccountId</summaryForeignKey>
<summaryOperation>sum</summaryOperation>
<type>Summary</type>
</fields>COUNT Rollup
<fields>
<fullName>Number_of_Contacts__c</fullName>
<label>Number of Contacts</label>
<summaryForeignKey>Contact.AccountId</summaryForeignKey>
<summaryOperation>count</summaryOperation>
<type>Summary</type>
</fields>MIN Rollup
<fields>
<fullName>Earliest_Close_Date__c</fullName>
<label>Earliest Close Date</label>
<summarizedField>Opportunity.CloseDate</summarizedField>
<summaryForeignKey>Opportunity.AccountId</summaryForeignKey>
<summaryOperation>min</summaryOperation>
<type>Summary</type>
</fields>MAX Rollup
<fields>
<fullName>Largest_Deal__c</fullName>
<label>Largest Deal</label>
<summarizedField>Opportunity.Amount</summarizedField>
<summaryForeignKey>Opportunity.AccountId</summaryForeignKey>
<summaryOperation>max</summaryOperation>
<type>Summary</type>
</fields>---
3. Geolocation Field
<fields>
<fullName>Location__c</fullName>
<label>Location</label>
<displayLocationInDecimal>true</displayLocationInDecimal>
<scale>6</scale>
<type>Location</type>
<required>false</required>
</fields>Usage Notes
- Access latitude:
Location__Latitude__s - Access longitude:
Location__Longitude__s - Display formats:
DecimalorDegMinSec - Scale: number of decimal places (up to 15)
- SOQL distance function:
DISTANCE(Location__c, GEOLOCATION(lat, lng), 'mi')
---
4. Global Value Set
<?xml version="1.0" encoding="UTF-8"?>
<GlobalValueSet xmlns="http://soap.sforce.com/2006/04/metadata">
<masterLabel>Industry Categories</masterLabel>
<description>Standardized industry categories across objects</description>
<sorted>true</sorted>
<customValue>
<fullName>Technology</fullName>
<label>Technology</label>
<default>false</default>
<isActive>true</isActive>
</customValue>
<customValue>
<fullName>Finance</fullName>
<label>Finance</label>
<default>false</default>
<isActive>true</isActive>
</customValue>
<customValue>
<fullName>Healthcare</fullName>
<label>Healthcare</label>
<default>false</default>
<isActive>true</isActive>
</customValue>
<customValue>
<fullName>Manufacturing</fullName>
<label>Manufacturing</label>
<default>false</default>
<isActive>true</isActive>
</customValue>
<customValue>
<fullName>Retail</fullName>
<label>Retail</label>
<default>false</default>
<isActive>true</isActive>
</customValue>
</GlobalValueSet>Referencing Global Value Set in a Field
<fields>
<fullName>Industry_Category__c</fullName>
<label>Industry Category</label>
<type>Picklist</type>
<valueSet>
<restricted>true</restricted>
<valueSetName>Industry_Categories</valueSetName>
</valueSet>
</fields>---
5. Record Type
<?xml version="1.0" encoding="UTF-8"?>
<RecordType xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Case.Support_Case</fullName>
<label>Support Case</label>
<active>true</active>
<description>Record type for customer support cases</description>
<businessProcess>Support Process</businessProcess>
<compactLayoutAssignment>Support_Compact</compactLayoutAssignment>
<picklistValues>
<picklist>Status</picklist>
<values>
<fullName>New</fullName>
<default>true</default>
</values>
<values>
<fullName>Working</fullName>
<default>false</default>
</values>
<values>
<fullName>Escalated</fullName>
<default>false</default>
</values>
<values>
<fullName>Closed</fullName>
<default>false</default>
</values>
</picklistValues>
</RecordType>---
6. Page Layout
<?xml version="1.0" encoding="UTF-8"?>
<Layout xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Account-Sales Layout</fullName>
<layoutSections>
<customLabel>true</customLabel>
<detailHeading>true</detailHeading>
<editHeading>true</editHeading>
<label>Account Information</label>
<style>TwoColumnsLeftToRight</style>
<layoutColumns>
<layoutItems>
<behavior>Required</behavior>
<field>Name</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>Phone</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>Industry</field>
</layoutItems>
</layoutColumns>
<layoutColumns>
<layoutItems>
<behavior>Edit</behavior>
<field>OwnerId</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>AnnualRevenue</field>
</layoutItems>
<layoutItems>
<behavior>Readonly</behavior>
<field>Rating</field>
</layoutItems>
</layoutColumns>
</layoutSections>
<layoutSections>
<customLabel>true</customLabel>
<detailHeading>true</detailHeading>
<editHeading>true</editHeading>
<label>Address Information</label>
<style>TwoColumnsLeftToRight</style>
<layoutColumns>
<layoutItems>
<behavior>Edit</behavior>
<field>BillingAddress</field>
</layoutItems>
</layoutColumns>
<layoutColumns>
<layoutItems>
<behavior>Edit</behavior>
<field>ShippingAddress</field>
</layoutItems>
</layoutColumns>
</layoutSections>
<relatedLists>
<fields>FULL_NAME</fields>
<fields>CONTACT.TITLE</fields>
<fields>CONTACT.EMAIL</fields>
<fields>CONTACT.PHONE1</fields>
<relatedList>RelatedContactList</relatedList>
</relatedLists>
<relatedLists>
<fields>OPPORTUNITY.NAME</fields>
<fields>OPPORTUNITY.STAGE_NAME</fields>
<fields>OPPORTUNITY.AMOUNT</fields>
<fields>OPPORTUNITY.CLOSE_DATE</fields>
<relatedList>RelatedOpportunityList</relatedList>
</relatedLists>
<miniLayout>
<fields>Name</fields>
<fields>Phone</fields>
<fields>Industry</fields>
<relatedLists>
<relatedList>RelatedContactList</relatedList>
</relatedLists>
</miniLayout>
</Layout>---
7. Compact Layout
<?xml version="1.0" encoding="UTF-8"?>
<CompactLayout xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Account.Sales_Compact</fullName>
<label>Sales Compact Layout</label>
<fields>Name</fields>
<fields>Phone</fields>
<fields>Industry</fields>
<fields>AnnualRevenue</fields>
<fields>OwnerId</fields>
</CompactLayout>---
8. FlexiPage (Lightning Record Page)
<?xml version="1.0" encoding="UTF-8"?>
<FlexiPage xmlns="http://soap.sforge.com/2006/04/metadata">
<flexiPageType>RecordPage</flexiPageType>
<masterLabel>Account Record Page</masterLabel>
<sobjectType>Account</sobjectType>
<template>
<name>flexipage:defaultPageTemplate2</name>
</template>
<flexiPageRegions>
<name>header</name>
<mode>Replace</mode>
<type>Region</type>
<itemInstances>
<componentInstance>
<componentName>force:highlights</componentName>
</componentInstance>
</itemInstances>
</flexiPageRegions>
<flexiPageRegions>
<name>main</name>
<mode>Replace</mode>
<type>Region</type>
<itemInstances>
<componentInstance>
<componentName>force:recordDetail</componentName>
</componentInstance>
</itemInstances>
<itemInstances>
<componentInstance>
<componentName>c:customAccountDashboard</componentName>
<componentInstanceProperties>
<name>showChart</name>
<value>true</value>
</componentInstanceProperties>
<visibilityRule>
<criteria>
<leftValue>{!Record.AnnualRevenue}</leftValue>
<operator>GREATERTHAN</operator>
<rightValue>1000000</rightValue>
</criteria>
</visibilityRule>
</componentInstance>
</itemInstances>
</flexiPageRegions>
<flexiPageRegions>
<name>sidebar</name>
<mode>Replace</mode>
<type>Region</type>
<itemInstances>
<componentInstance>
<componentName>force:relatedListContainer</componentName>
</componentInstance>
</itemInstances>
</flexiPageRegions>
</FlexiPage>---
9. Custom Metadata Type
Type Definition
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Integration_Setting__mdt</fullName>
<label>Integration Setting</label>
<pluralLabel>Integration Settings</pluralLabel>
<visibility>Public</visibility>
<fields>
<fullName>Endpoint__c</fullName>
<label>Endpoint</label>
<type>Url</type>
<required>true</required>
</fields>
<fields>
<fullName>Timeout__c</fullName>
<label>Timeout (ms)</label>
<type>Number</type>
<precision>5</precision>
<scale>0</scale>
<required>false</required>
<defaultValue>30000</defaultValue>
</fields>
<fields>
<fullName>Is_Active__c</fullName>
<label>Is Active</label>
<type>Checkbox</type>
<defaultValue>true</defaultValue>
</fields>
<fields>
<fullName>Batch_Size__c</fullName>
<label>Batch Size</label>
<type>Number</type>
<precision>4</precision>
<scale>0</scale>
<defaultValue>200</defaultValue>
</fields>
</CustomObject>Record Instance
<?xml version="1.0" encoding="UTF-8"?>
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata">
<label>ERP Integration</label>
<protected>false</protected>
<values>
<field>Endpoint__c</field>
<value>https://erp.example.com/api/v2</value>
</values>
<values>
<field>Timeout__c</field>
<value>15000</value>
</values>
<values>
<field>Is_Active__c</field>
<value>true</value>
</values>
<values>
<field>Batch_Size__c</field>
<value>100</value>
</values>
</CustomMetadata>Apex Access Pattern
// Query all active settings
List<Integration_Setting__mdt> settings = [
SELECT Label, Endpoint__c, Timeout__c, Batch_Size__c
FROM Integration_Setting__mdt
WHERE Is_Active__c = true
];
// Get specific record
Integration_Setting__mdt erp = Integration_Setting__mdt.getInstance('ERP_Integration');
String endpoint = erp.Endpoint__c;---
10. Custom Settings (Hierarchy)
Definition
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Feature_Flags__c</fullName>
<label>Feature Flags</label>
<customSettingsType>Hierarchy</customSettingsType>
<visibility>Public</visibility>
<fields>
<fullName>Enable_Integration__c</fullName>
<label>Enable Integration</label>
<type>Checkbox</type>
<defaultValue>false</defaultValue>
</fields>
<fields>
<fullName>Debug_Mode__c</fullName>
<label>Debug Mode</label>
<type>Checkbox</type>
<defaultValue>false</defaultValue>
</fields>
<fields>
<fullName>Max_Records__c</fullName>
<label>Max Records</label>
<type>Number</type>
<precision>6</precision>
<scale>0</scale>
</fields>
</CustomObject>Apex Access
// Get for current user (respects hierarchy: User > Profile > Org)
Feature_Flags__c flags = Feature_Flags__c.getInstance();
Boolean integrationEnabled = flags.Enable_Integration__c;
// Get org defaults
Feature_Flags__c orgDefaults = Feature_Flags__c.getOrgDefaults();
// Get for specific user
Feature_Flags__c userFlags = Feature_Flags__c.getInstance(userId);
// Get for specific profile
Feature_Flags__c profileFlags = Feature_Flags__c.getInstance(profileId);---
11. Platform Event
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Order_Event__e</fullName>
<label>Order Event</label>
<pluralLabel>Order Events</pluralLabel>
<deploymentStatus>Deployed</deploymentStatus>
<eventType>HighVolume</eventType>
<publishBehavior>PublishAfterCommit</publishBehavior>
<fields>
<fullName>Order_Id__c</fullName>
<label>Order ID</label>
<type>Text</type>
<length>18</length>
<isFilteringDisabled>false</isFilteringDisabled>
<isNameField>false</isNameField>
<isSortingDisabled>false</isSortingDisabled>
</fields>
<fields>
<fullName>Action__c</fullName>
<label>Action</label>
<type>Text</type>
<length>50</length>
</fields>
<fields>
<fullName>Payload__c</fullName>
<label>Payload</label>
<type>LongTextArea</type>
<length>131072</length>
<visibleLines>5</visibleLines>
</fields>
</CustomObject>Publish Behavior Options
PublishAfterCommit— Event published after transaction commits (default)PublishImmediately— Event published immediately, regardless of transaction outcome
Apex Publish/Subscribe
// Publish
Order_Event__e event = new Order_Event__e(
Order_Id__c = '001ABC',
Action__c = 'Created',
Payload__c = '{"status": "new"}'
);
Database.SaveResult sr = EventBus.publish(event);
// Subscribe via trigger
trigger OrderEventTrigger on Order_Event__e (after insert) {
for (Order_Event__e event : Trigger.New) {
// Process event
}
}---
12. Big Object
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Customer_Interaction__b</fullName>
<label>Customer Interaction</label>
<pluralLabel>Customer Interactions</pluralLabel>
<deploymentStatus>Deployed</deploymentStatus>
<fields>
<fullName>Account_Id__c</fullName>
<label>Account ID</label>
<type>Text</type>
<length>18</length>
<required>true</required>
</fields>
<fields>
<fullName>Interaction_Date__c</fullName>
<label>Interaction Date</label>
<type>DateTime</type>
<required>true</required>
</fields>
<fields>
<fullName>Channel__c</fullName>
<label>Channel</label>
<type>Text</type>
<length>50</length>
</fields>
<fields>
<fullName>Details__c</fullName>
<label>Details</label>
<type>LongTextArea</type>
<length>32000</length>
<visibleLines>5</visibleLines>
</fields>
<indexes>
<fullName>CustomerInteractionIndex</fullName>
<label>Customer Interaction Index</label>
<fields>
<name>Account_Id__c</name>
<sortDirection>ASC</sortDirection>
</fields>
<fields>
<name>Interaction_Date__c</name>
<sortDirection>DESC</sortDirection>
</fields>
</indexes>
</CustomObject>---
13. Custom Tab
<?xml version="1.0" encoding="UTF-8"?>
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>My_Custom_Object__c</fullName>
<customObject>true</customObject>
<label>My Custom Object</label>
<description>Tab for managing custom object records</description>
<motif>Custom68: Desk</motif>
<mobileReady>true</mobileReady>
</CustomTab>Lightning Web Component Tab
<?xml version="1.0" encoding="UTF-8"?>
<CustomTab xmlns="http://soap.sforge.com/2006/04/metadata">
<fullName>My_LWC_Tab</fullName>
<label>My LWC Dashboard</label>
<description>Custom LWC dashboard tab</description>
<lwcComponent>myDashboardComponent</lwcComponent>
<motif>Custom100: Shield</motif>
</CustomTab>Visualforce Tab
<?xml version="1.0" encoding="UTF-8"?>
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>My_VF_Tab</fullName>
<label>Legacy Dashboard</label>
<page>MyVisualforcePage</page>
<motif>Custom50: Compass</motif>
</CustomTab>---
14. Quick Action
Create Action
<?xml version="1.0" encoding="UTF-8"?>
<QuickAction xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Account.New_Case</fullName>
<label>New Case</label>
<type>Create</type>
<targetObject>Case</targetObject>
<targetParentField>AccountId</targetParentField>
<description>Create a new case from Account</description>
<successMessage>Case created successfully</successMessage>
<quickActionLayout>
<layoutSectionStyle>TwoColumnsLeftToRight</layoutSectionStyle>
<quickActionLayoutColumns>
<quickActionLayoutItems>
<field>Subject</field>
<uiBehavior>Required</uiBehavior>
</quickActionLayoutItems>
<quickActionLayoutItems>
<field>Priority</field>
<uiBehavior>Edit</uiBehavior>
</quickActionLayoutItems>
</quickActionLayoutColumns>
<quickActionLayoutColumns>
<quickActionLayoutItems>
<field>Status</field>
<uiBehavior>Readonly</uiBehavior>
</quickActionLayoutItems>
</quickActionLayoutColumns>
</quickActionLayout>
</QuickAction>Update Action
<?xml version="1.0" encoding="UTF-8"?>
<QuickAction xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Case.Escalate</fullName>
<label>Escalate</label>
<type>Update</type>
<targetObject>Case</targetObject>
<quickActionLayout>
<layoutSectionStyle>OneColumn</layoutSectionStyle>
<quickActionLayoutColumns>
<quickActionLayoutItems>
<field>Priority</field>
<uiBehavior>Edit</uiBehavior>
</quickActionLayoutItems>
<quickActionLayoutItems>
<field>Description</field>
<uiBehavior>Edit</uiBehavior>
</quickActionLayoutItems>
</quickActionLayoutColumns>
</quickActionLayout>
</QuickAction>Log a Call Action
<?xml version="1.0" encoding="UTF-8"?>
<QuickAction xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Contact.Log_Call</fullName>
<label>Log a Call</label>
<type>LogACall</type>
<targetObject>Task</targetObject>
<targetParentField>WhoId</targetParentField>
<quickActionLayout>
<layoutSectionStyle>OneColumn</layoutSectionStyle>
<quickActionLayoutColumns>
<quickActionLayoutItems>
<field>Subject</field>
<uiBehavior>Required</uiBehavior>
</quickActionLayoutItems>
<quickActionLayoutItems>
<field>Description</field>
<uiBehavior>Edit</uiBehavior>
</quickActionLayoutItems>
</quickActionLayoutColumns>
</quickActionLayout>
</QuickAction>---
15. Custom Label
<?xml version="1.0" encoding="UTF-8"?>
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
<labels>
<fullName>Error_No_Permission</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Error No Permission</shortDescription>
<value>You do not have permission to perform this action.</value>
<categories>Errors,UI</categories>
</labels>
<labels>
<fullName>Success_Record_Saved</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Success Record Saved</shortDescription>
<value>Record saved successfully.</value>
<categories>Success,UI</categories>
</labels>
<labels>
<fullName>Batch_Job_Complete</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>Batch Job Complete</shortDescription>
<value>Batch job completed. {0} records processed, {1} errors.</value>
<categories>Notifications</categories>
</labels>
</CustomLabels>Apex Usage
String msg = System.Label.Error_No_Permission;
// With parameters (using String.format)
String result = String.format(System.Label.Batch_Job_Complete, new List<String>{'500', '3'});LWC Usage
import ERROR_LABEL from '@salesforce/label/c.Error_No_Permission';---
16. List View
<?xml version="1.0" encoding="UTF-8"?>
<ListView xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Account.High_Value_Accounts</fullName>
<label>High Value Accounts</label>
<filterScope>Everything</filterScope>
<columns>NAME</columns>
<columns>ACCOUNT_NUMBER</columns>
<columns>INDUSTRY</columns>
<columns>ACCOUNT.ANNUAL_REVENUE</columns>
<columns>ACCOUNT.PHONE1</columns>
<columns>CORE.USERS.ALIAS</columns>
<filters>
<field>ACCOUNT.ANNUAL_REVENUE</field>
<operation>greaterThan</operation>
<value>1000000</value>
</filters>
<filters>
<field>ACCOUNT.INDUSTRY</field>
<operation>equals</operation>
<value>Technology,Finance,Healthcare</value>
</filters>
<language>en_US</language>
<sharedTo>
<role>SalesManager</role>
<group>AllInternalUsers</group>
</sharedTo>
</ListView>Filter Scope Options
Everything— All recordsMine— My recordsMineAndMyGroups— My records and my groups' recordsQueue— Records in specific queueDelegated— Delegated recordsTeam— My team's records
---
17. Path
<?xml version="1.0" encoding="UTF-8"?>
<PathAssistant xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Opportunity_Sales_Path</fullName>
<active>true</active>
<entityName>Opportunity</entityName>
<fieldName>StageName</fieldName>
<masterLabel>Sales Path</masterLabel>
<recordTypeName>B2B_Sale</recordTypeName>
<pathAssistantSteps>
<fieldNames>Amount</fieldNames>
<fieldNames>CloseDate</fieldNames>
<info>Identify the opportunity and gather initial requirements.</info>
<picklistValueName>Prospecting</picklistValueName>
</pathAssistantSteps>
<pathAssistantSteps>
<fieldNames>NextStep</fieldNames>
<fieldNames>Description</fieldNames>
<info>Qualify the lead and confirm budget, authority, need, timeline.</info>
<picklistValueName>Qualification</picklistValueName>
</pathAssistantSteps>
<pathAssistantSteps>
<fieldNames>Amount</fieldNames>
<fieldNames>Probability</fieldNames>
<info>Prepare and deliver the proposal to the customer.</info>
<picklistValueName>Proposal/Price Quote</picklistValueName>
</pathAssistantSteps>
<pathAssistantSteps>
<fieldNames>Amount</fieldNames>
<fieldNames>CloseDate</fieldNames>
<info>Negotiate terms and finalize the deal.</info>
<picklistValueName>Negotiation/Review</picklistValueName>
</pathAssistantSteps>
<pathAssistantSteps>
<fieldNames>Amount</fieldNames>
<info>Congratulations! Close the deal and hand off to delivery.</info>
<picklistValueName>Closed Won</picklistValueName>
</pathAssistantSteps>
</PathAssistant>---
18. Multi-Select Picklist
<fields>
<fullName>Preferred_Channels__c</fullName>
<label>Preferred Channels</label>
<type>MultiselectPicklist</type>
<required>false</required>
<visibleLines>4</visibleLines>
<valueSet>
<restricted>true</restricted>
<valueSetDefinition>
<sorted>false</sorted>
<value>
<fullName>Email</fullName>
<label>Email</label>
<default>false</default>
<isActive>true</isActive>
</value>
<value>
<fullName>Phone</fullName>
<label>Phone</label>
<default>false</default>
<isActive>true</isActive>
</value>
<value>
<fullName>SMS</fullName>
<label>SMS</label>
<default>false</default>
<isActive>true</isActive>
</value>
<value>
<fullName>Social_Media</fullName>
<label>Social Media</label>
<default>false</default>
<isActive>true</isActive>
</value>
<value>
<fullName>In_Person</fullName>
<label>In Person</label>
<default>false</default>
<isActive>true</isActive>
</value>
</valueSetDefinition>
</valueSet>
</fields>SOQL with Multi-Select Picklist
// Use INCLUDES/EXCLUDES for multi-select picklist filters
List<Contact> contacts = [
SELECT Id, Name, Preferred_Channels__c
FROM Contact
WHERE Preferred_Channels__c INCLUDES ('Email', 'Phone')
];
// Values stored as semicolon-separated: "Email;Phone;SMS"---
19. Dependent Picklist
Controlling Field (Standard Picklist)
<fields>
<fullName>Region__c</fullName>
<label>Region</label>
<type>Picklist</type>
<valueSet>
<restricted>false</restricted>
<valueSetDefinition>
<sorted>false</sorted>
<value>
<fullName>North America</fullName>
<label>North America</label>
<default>false</default>
</value>
<value>
<fullName>Europe</fullName>
<label>Europe</label>
<default>false</default>
</value>
<value>
<fullName>Asia Pacific</fullName>
<label>Asia Pacific</label>
<default>false</default>
</value>
</valueSetDefinition>
</valueSet>
</fields>Dependent Field
<fields>
<fullName>Country__c</fullName>
<label>Country</label>
<type>Picklist</type>
<valueSet>
<controllingField>Region__c</controllingField>
<restricted>false</restricted>
<valueSetDefinition>
<sorted>false</sorted>
<value>
<fullName>United States</fullName>
<label>United States</label>
<default>false</default>
</value>
<value>
<fullName>Canada</fullName>
<label>Canada</label>
<default>false</default>
</value>
<value>
<fullName>United Kingdom</fullName>
<label>United Kingdom</label>
<default>false</default>
</value>
<value>
<fullName>Germany</fullName>
<label>Germany</label>
<default>false</default>
</value>
<value>
<fullName>Japan</fullName>
<label>Japan</label>
<default>false</default>
</value>
<value>
<fullName>Australia</fullName>
<label>Australia</label>
<default>false</default>
</value>
</valueSetDefinition>
<valueSettings>
<controllingFieldValue>North America</controllingFieldValue>
<valueName>United States</valueName>
</valueSettings>
<valueSettings>
<controllingFieldValue>North America</controllingFieldValue>
<valueName>Canada</valueName>
</valueSettings>
<valueSettings>
<controllingFieldValue>Europe</controllingFieldValue>
<valueName>United Kingdom</valueName>
</valueSettings>
<valueSettings>
<controllingFieldValue>Europe</controllingFieldValue>
<valueName>Germany</valueName>
</valueSettings>
<valueSettings>
<controllingFieldValue>Asia Pacific</controllingFieldValue>
<valueName>Japan</valueName>
</valueSettings>
<valueSettings>
<controllingFieldValue>Asia Pacific</controllingFieldValue>
<valueName>Australia</valueName>
</valueSettings>
</valueSet>
</fields>---
20. Encrypted Text Field
<fields>
<fullName>SSN__c</fullName>
<label>Social Security Number</label>
<type>EncryptedText</type>
<length>11</length>
<maskChar>asterisk</maskChar>
<maskType>lastFour</maskType>
<required>false</required>
</fields>Mask Character Options
asterisk— Masks with*charactersX— Masks withXcharacters
Mask Type Options
all— Masks all characterslastFour— Shows last 4 characters (e.g.,*******6789)creditCard— Shows last 4 digits in credit card format (e.g.,****-****-****-1234)nino— National Insurance Number formatsin— Social Insurance Number formatssn— Social Security Number format (e.g.,***-**-6789)
Limitations
- Maximum 175 characters
- Cannot be used as an External ID
- Cannot be unique
- Cannot use in filters, reports, SOQL WHERE
- Classic encryption (not Shield Platform Encryption)
- Cannot be used in formula fields
Related skills
FAQ
Is Sf Schema safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.