Loading...
Loading...
Use this skill when users need to create, generate, or validate Salesforce Custom Object metadata. Trigger when users mention custom objects, creating objects, object metadata, .object files, sharing models, name fields, or validation rules on objects. Also use when users say things like "create a custom object", "generate object metadata", "set up an object for...", or when they're troubleshooting object deployment errors especially around sharing models and Master-Detail relationships. Always use this skill for any custom object metadata work.
npx skill4agent add forcedotcom/afv-library generating-custom-object.object-meta.xml.object-meta.xmlVehicle__c.object-meta.xml| Element | Requirement | Notes |
|---|---|---|
| Required | Singular UI name |
| Required | Plural UI name |
| Required | See Sharing Model Rules below |
| Required | Always set to |
| Required | Primary record identifier (requires |
| Required | Always set to |
<sharingModel>ReadWrite<sharingModel>ControlledByParentReadWriteControlledByParent<sharingModel>ControlledByParentCannot set sharingModel to ReadWrite on a CustomObject with a MasterDetail relationship field<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Order Line Item</label>
<pluralLabel>Order Line Items</pluralLabel>
<sharingModel>ReadWrite</sharingModel> <!-- WRONG: Object has a M-D field -->
<deploymentStatus>Deployed</deploymentStatus>
</CustomObject><CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Order Line Item</label>
<pluralLabel>Order Line Items</pluralLabel>
<sharingModel>ControlledByParent</sharingModel> <!-- CORRECT -->
<deploymentStatus>Deployed</deploymentStatus>
</CustomObject>| Type | When to Use | Additional Requirements |
|---|---|---|
| Text | Default for human-named entities (Projects, Locations, Teams) | None |
| AutoNumber | Use for transactions, logs, or IDs (Invoices, Requests, Tickets) | Must include |
<nameField>
<label>Project Name</label>
<type>Text</type>
</nameField><nameField>
<label>Invoice Number</label>
<type>AutoNumber</type>
<displayFormat>INV-{0000}</displayFormat>
<startingNumber>1</startingNumber>
</nameField><description>"Object used to track and manage [Intent] within the organization."
Position_Candidate__cJob_Application__cfalse<enableSearch><enableReports><enableActivities><enableHistory>true| Category | Reserved Words (Do Not Use as API Names) |
|---|---|
| SOQL/SQL | |
| System | |
| Temporal | |
<fullName>.object-meta.xml<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Vehicle__c</fullName> <!-- WRONG: Remove this -->
<label>Vehicle</label>
</CustomObject><CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Vehicle</label>
<!-- fullName comes from filename: Vehicle__c.object-meta.xml -->
</CustomObject>__c<validationRules>
<fullName>Require_Start_Date__c</fullName> <!-- WRONG: Has __c suffix -->
<active>true</active>
<errorMessage>Start Date is required.</errorMessage>
<formula>ISBLANK(Start_Date__c)</formula>
</validationRules>The validation name can only contain alphanumeric characters, must begin with a letter, cannot end with an underscore...<validationRules>
<fullName>Require_Start_Date</fullName> <!-- CORRECT: No __c suffix -->
<active>true</active>
<errorMessage>Start Date is required.</errorMessage>
<formula>ISBLANK(Start_Date__c)</formula>
</validationRules>| Metadata Type | Naming Pattern | Example |
|---|---|---|
| Custom Fields | Ends with | |
| Validation Rules | No suffix | |
| Custom Objects | Ends with | |
<label><pluralLabel><deploymentStatus>Deployed<visibility>Public<nameField><label><type><type>AutoNumber<displayFormat><startingNumber><sharingModel>ControlledByParent<sharingModel>ReadWrite<fullName>__c<description><enableSearch><enableReports>true