generating-custom-tab
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen to Use This Skill
何时使用此技能
Use this skill when you need to:
- Create tabs for objects, web pages, or Visualforce pages
- Add navigation tabs to applications
- Configure tab visibility and access
- Troubleshoot deployment errors related to custom tabs
当你需要以下操作时使用此技能:
- 为对象、网页或Visualforce页面创建标签
- 为应用添加导航标签
- 配置标签可见性与访问权限
- 排查与自定义标签相关的部署错误
Specification
规范
CustomTab Metadata Specification
CustomTab元数据规范
📋 Overview
📋 概述
Custom tabs for navigating to objects, web content, or Visualforce pages within Salesforce applications.
Custom tabs用于在Salesforce应用内导航至对象、网页内容或Visualforce页面。
🎯 Purpose
🎯 用途
- Provide navigation to custom objects
- Link to external web content
- Access Visualforce pages
- Organize application navigation
- 提供自定义对象的导航入口
- 链接至外部网页内容
- 访问Visualforce页面
- 整理应用导航结构
⚙️ Required Properties
⚙️ 必填属性
Core Tab Properties
核心标签属性
- customObject: for custom object tabs,
truefor all others.false - 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)
- customObject: 自定义对象标签设为,其他类型标签设为
true。false - motif: 标签图标样式——选择与对象用途在语义上匹配的motif。请勿为所有标签重复使用相同的motif。
- label: 显示名称(仅非对象标签必填;对象标签从对象继承标签)
- url: 网页URL(适用于Web标签)
- page: Visualforce页面名称(适用于Visualforce标签)
🚨 STRICT ELEMENT ALLOWLIST — READ THIS FIRST
🚨 严格元素白名单 —— 请先阅读此部分
The root element MUST always be (NOT ). The XML namespace must be .
<CustomTab><Tab>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 | |
| Web tabs | |
| Visualforce tabs | |
根元素必须始终为(不能是)。XML命名空间必须为。
<CustomTab><Tab>xmlns="http://soap.sforce.com/2006/04/metadata"只有以下列出的元素是有效的。任何不在此列表中的元素都会导致部署错误。
| 标签类型 | 仅允许以下元素(无其他元素) |
|---|---|
| 对象标签 | |
| Web标签 | |
| Visualforce标签 | |
⚠️ 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:
- on object tabs (object tabs inherit their label from the custom object)
<label> - on web tabs (only for Visualforce tabs)
<page> - Empty elements like or
<page></page><description></description> - Any element not in the allowlist table above
<sobjectName><name><fullName><apiVersion><isHidden><tabVisibility><type><mobileReady><urlFrameHeight><urlType><urlRedirect><encodingKey><height><auraComponent>此外还禁用:
- 对象标签上的(对象标签从自定义对象继承标签)
<label> - Web标签上的(仅适用于Visualforce标签)
<page> - 空元素如或
<page></page><description></description> - 任何不在上述白名单表格中的元素
🔧 Tab Types
🔧 标签类型
Object Tabs
对象标签
- Purpose: Navigate to custom or standard objects
- File name determines the object: (e.g.,
{ObjectApiName}.tab-meta.xml)Space_Station__c.tab-meta.xml - Required elements: and
<customObject>true</customObject><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>, or<fullName>:<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>- 用途: 导航至自定义或标准对象
- 文件名决定对象:(例如:
{ObjectApiName}.tab-meta.xml)Space_Station__c.tab-meta.xml - 必填元素: 和
<customObject>true</customObject><motif> - 正确示例(针对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>- 正确示例(针对Supply__c.tab-meta.xml —— 注意使用不同的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>- ❌ 错误——请勿添加、
<sobjectName>、<name>或<fullName>:<label>
xml
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata">
<sobjectName>Space_Station__c</sobjectName> <!-- 部署错误 -->
<label>Space Station</label> <!-- 对象标签的部署错误 -->
<customObject>true</customObject>
<motif>Custom57: Desert</motif>
</CustomTab>Web Tabs
Web标签
- Purpose: Link to external websites or web applications
- File name: Use a descriptive name: (e.g.,
{TabName}.tab-meta.xml)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 element is optional — you may remove it if not needed, but do not add anything else.
<description>
- 用途: 链接至外部网站或Web应用
- 文件名: 使用描述性名称:(例如:
{TabName}.tab-meta.xml)Knowledge_Base.tab-meta.xml - 复制此精确模板——仅替换占位符值。请勿添加、删除或重命名任何XML元素:
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>- 上述7个元素是Web标签文件中仅允许的元素。请勿添加任何其他元素。
- 元素是可选的——如果不需要可以移除,但请勿添加其他内容。
<description>
Visualforce Tabs
Visualforce标签
- Purpose: Access custom Visualforce pages
- File name: (e.g.,
{TabName}.tab-meta.xml)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>- 用途: 访问自定义Visualforce页面
- 文件名: (例如:
{TabName}.tab-meta.xml)Custom_Page_Tab.tab-meta.xml - 必填元素: 、
<customObject>false</customObject>、<label>、<motif><page> - 正确示例:
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
🎨 标签配置
Tab Style
标签样式
- Default: Use standard tab styling
- Custom: Can specify custom tab styles if needed
- 默认: 使用标准标签样式
- 自定义: 如有需要可指定自定义标签样式
Tab Visibility
标签可见性
- Default: Visible to all users with access
- Custom: Can be configured for specific user profiles
- 默认: 对所有有权限的用户可见
- 自定义: 可为特定用户配置文件进行设置
📱 Supported Applications
📱 支持的应用
- Standard Apps: Available in standard Salesforce applications
- Custom Apps: Can be included in custom applications
- Community Apps: Available in community applications
- 标准应用: 可在标准Salesforce应用中使用
- 自定义应用: 可包含在自定义应用中
- 社区应用: 可在社区应用中使用
🔗 Integration Points
🔗 集成点
- Object Relationships: Links to related object records
- Web Content: External website integration
- Visualforce Pages: Custom page functionality
- Lightning Components: Modern component integration
- 对象关系: 链接至相关对象记录
- 网页内容: 外部网站集成
- Visualforce页面: 自定义页面功能
- Lightning组件: 现代组件集成
✅ 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 and
<customObject>true</customObject>— nothing else<motif> - Web tab files MUST only contain: ,
<customObject>false</customObject>,<label>,<motif>,<url>, and optionally<urlEncodingKey>,<description>— nothing else<frameHeight> - Never include ,
<isHidden>,<tabVisibility>,<type>, or empty elements<mobileReady>
- 使用清晰、描述性的标签名称
- 为功能选择合适的标签类型
- 为每个标签选择独特且与上下文相关的motif——不要默认所有标签使用相同图标
- 考虑用户体验与导航流程
- 在不同应用中测试标签功能
- 确保权限与可见性设置正确
- 遵循一致的命名规范
- 对象标签文件必须仅包含和
<customObject>true</customObject>——无其他内容<motif> - Web标签文件必须仅包含:、
<customObject>false</customObject>、<label>、<motif>、<url>,以及可选的<urlEncodingKey>、<description>——无其他内容<frameHeight> - 切勿包含、
<isHidden>、<tabVisibility>、<type>或空元素<mobileReady>