Merge branch 'forcedotcom:main' into main

This commit is contained in:
sowmya-sriram 2026-03-16 14:51:26 +05:30 committed by GitHub
commit 91abe43af9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 87 additions and 11 deletions

View File

@ -8,7 +8,7 @@ Enforce: **skill load → API context → file generation** for all Salesforce m
1. **Never write** without both: metadata type skill loaded AND `get_metadata_api_context` called for that type
2. **One type at a time** - complete full cycle before next type
3. **One type per API call** - no batching
4. **No cross-type content** in files
4. **Child types need own context** - if adding any child metadata inside a parent metadata's file, load skill and call `get_metadata_api_context` for each child type (e.g. CustomField inside CustomObject) separately; don't rely on the parent's schema for creating child metadata
5. **Max one clarifying question** before starting
## Workflow
@ -51,9 +51,9 @@ Enforce: **skill load → API context → file generation** for all Salesforce m
### 3. Deploy Verification
```bash
sf project deploy start --dry-run -d "<path>" --target-org <alias> --test-level NoTestRun --wait 10 --json
sf project deploy start --dry-run -d "force-app/main/default" --target-org <alias> --test-level NoTestRun --wait 10 --json
```
On failure: attempt to fix the errors and re-run, retrying up to a maximum of 5 times until it succeeds.
On failure: attempt to fix the errors and re-run, retrying up to a maximum of 3 times until it succeeds.
## Anti-Patterns

View File

@ -27,27 +27,99 @@ Custom tabs for navigating to objects, web content, or Visualforce pages within
## ⚙️ Required Properties
### Core Tab Properties
- **label**: Display name of the tab
- **fullName**: API name of the object (for object tabs)
- **customObject**: `true` for custom object tabs, `false` for all others.
- **motif**: Tab icon style — choose a motif that semantically matches the object's purpose. Do NOT reuse the same motif for every tab.
- **label**: Display name (required for non-object tabs ONLY; object tabs inherit label from the object)
- **url**: Web URL (for web tabs)
- **page**: Visualforce page name (for Visualforce tabs)
### 🚨 STRICT ELEMENT ALLOWLIST — READ THIS FIRST
**The root element MUST always be `<CustomTab>` (NOT `<Tab>`).** The XML namespace must be `xmlns="http://soap.sforce.com/2006/04/metadata"`.
Only the elements listed below are valid. **Any element not on this list WILL cause a deployment error.**
| Tab Type | ONLY these elements are allowed (nothing else) |
|---|---|
| **Object tabs** | `<customObject>` (required, set to `true`), `<motif>` (required), `<description>` (optional) |
| **Web tabs** | `<customObject>` (required, set to `false`), `<label>` (required), `<motif>` (required), `<url>` (required), `<urlEncodingKey>` (required, set to `UTF-8`), `<description>` (optional), `<frameHeight>` (optional) |
| **Visualforce tabs** | `<customObject>` (required, set to `false`), `<label>` (required), `<motif>` (required), `<page>` (required), `<description>` (optional) |
### ⚠️ FORBIDDEN ELEMENTS (every one of these causes a deployment error)
`<sobjectName>`, `<name>`, `<fullName>`, `<apiVersion>`, `<isHidden>`, `<tabVisibility>`, `<type>`, `<mobileReady>`, `<urlFrameHeight>`, `<urlType>`, `<urlRedirect>`, `<encodingKey>`, `<height>`, `<auraComponent>`
Also forbidden:
- `<label>` on object tabs (object tabs inherit their label from the custom object)
- `<page>` on web tabs (only for Visualforce tabs)
- Empty elements like `<page></page>` or `<description></description>`
- Any element not in the allowlist table above
## 🔧 Tab Types
### Object Tabs
- **Purpose**: Navigate to custom or standard objects
- **Required**: `fullName` property (set to object API name)
- **Example**: `<fullName>CustomObject__c</fullName>`
- **File name** determines the object: `{ObjectApiName}.tab-meta.xml` (e.g., `Space_Station__c.tab-meta.xml`)
- **Required elements**: `<customObject>true</customObject>` and `<motif>`
- **Correct example** (for a Space_Station__c.tab-meta.xml):
```xml
<?xml version="1.0" encoding="UTF-8"?>
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<customObject>true</customObject>
<motif>Custom39: Telescope</motif>
</CustomTab>
```
- **Correct example** (for a Supply__c.tab-meta.xml — note different motif):
```xml
<?xml version="1.0" encoding="UTF-8"?>
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<customObject>true</customObject>
<motif>Custom98: Truck</motif>
</CustomTab>
```
- **❌ WRONG** — do NOT add `<sobjectName>`, `<name>`, `<fullName>`, or `<label>`:
```xml
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<sobjectName>Space_Station__c</sobjectName> <!-- DEPLOYMENT ERROR -->
<label>Space Station</label> <!-- DEPLOYMENT ERROR on object tabs -->
<customObject>true</customObject>
<motif>Custom57: Desert</motif>
</CustomTab>
```
### Web Tabs
- **Purpose**: Link to external websites or web applications
- **Required**: `url` property
- **Example**: `<url>https://example.com</url>`
- **File name**: Use a descriptive name: `{TabName}.tab-meta.xml` (e.g., `Knowledge_Base.tab-meta.xml`)
- **COPY THIS EXACT TEMPLATE** — only replace the placeholder values. Do NOT add, remove, or rename any XML elements:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<customObject>false</customObject>
<description>REPLACE_WITH_DESCRIPTION</description>
<frameHeight>600</frameHeight>
<label>REPLACE_WITH_LABEL</label>
<motif>REPLACE_WITH_MOTIF</motif>
<url>REPLACE_WITH_URL</url>
<urlEncodingKey>UTF-8</urlEncodingKey>
</CustomTab>
```
- **These 7 elements above are the ONLY elements allowed in a web tab file.** Do not add ANY other elements.
- The `<description>` element is optional — you may remove it if not needed, but do not add anything else.
### Visualforce Tabs
- **Purpose**: Access custom Visualforce pages
- **Required**: `page` property
- **Example**: `<page>CustomPage</page>`
- **File name**: `{TabName}.tab-meta.xml` (e.g., `Custom_Page_Tab.tab-meta.xml`)
- **Required elements**: `<customObject>false</customObject>`, `<label>`, `<motif>`, `<page>`
- **Correct example**:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<customObject>false</customObject>
<label>Custom Page</label>
<motif>Custom46: Computer</motif>
<page>CustomPage</page>
</CustomTab>
```
## 🎨 Tab Configuration
@ -72,7 +144,11 @@ Custom tabs for navigating to objects, web content, or Visualforce pages within
## ✅ Best Practices
- Use clear, descriptive tab labels
- Choose appropriate tab types for functionality
- **Select a unique, contextually relevant motif for each tab** — do not default every tab to the same icon
- Consider user experience and navigation flow
- Test tab functionality across different applications
- Ensure proper permissions and visibility settings
- Follow consistent naming conventions
- Object tab files MUST only contain `<customObject>true</customObject>` and `<motif>` — nothing else
- Web tab files MUST only contain: `<customObject>false</customObject>`, `<label>`, `<motif>`, `<url>`, `<urlEncodingKey>`, and optionally `<description>`, `<frameHeight>` — nothing else
- Never include `<isHidden>`, `<tabVisibility>`, `<type>`, `<mobileReady>`, or empty elements