
Sf Schema
Generate and validate Salesforce custom field, formula, and object metadata XML when extending a CRM-backed app or sync layer.
Install
npx skills add https://github.com/clientell-ai/salesforce-skills --skill sf-schemaWhat is this skill?
- 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
Adoption & trust: 1 installs on skills.sh; 7 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Schema XML is authored when wiring Salesforce into a product, which sits in the build phase’s integrations shelf. Salesforce metadata is an external platform contract—formula fields, cross-object refs, and object defs are integration work, not generic frontend.
Common Questions / 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.
SKILL.md
READMESKILL.md - Sf Schema
# Salesforce Schema Metadata XML Reference ## 1. Formula Field ### Text Formula ```xml <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 ```xml <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 ```xml <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 ```xml <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 ```xml <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 ```xml <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 ```xml <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 ```xml <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 ```xml <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 ```xml <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: `Decimal` or `DegMinSec` - Scale: number of decimal places (up to 15) - SOQL distance function: `DISTANCE(Location__c, GEOLOCATION(lat, lng), 'mi')` --- ## 4. Global Value Set ```xml <?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>