generating-custom-tab

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

When 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:
    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)
  • 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
<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 TypeONLY 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)
根元素必须始终为
<CustomTab>
(不能是
<Tab>
。XML命名空间必须为
xmlns="http://soap.sforce.com/2006/04/metadata"
只有以下列出的元素是有效的。任何不在此列表中的元素都会导致部署错误。
标签类型仅允许以下元素(无其他元素)
对象标签
<customObject>
(必填,设为
true
)、
<motif>
(必填)、
<description>
(可选)
Web标签
<customObject>
(必填,设为
false
)、
<label>
(必填)、
<motif>
(必填)、
<url>
(必填)、
<urlEncodingKey>
(必填,设为
UTF-8
)、
<description>
(可选)、
<frameHeight>
(可选)
Visualforce标签
<customObject>
(必填,设为
false
)、
<label>
(必填)、
<motif>
(必填)、
<page>
(必填)、
<description>
(可选)

⚠️ 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
<sobjectName>
,
<name>
,
<fullName>
,
<apiVersion>
,
<isHidden>
,
<tabVisibility>
,
<type>
,
<mobileReady>
,
<urlFrameHeight>
,
<urlType>
,
<urlRedirect>
,
<encodingKey>
,
<height>
,
<auraComponent>
此外还禁用:
  • 对象标签上的
    <label>
    (对象标签从自定义对象继承标签)
  • Web标签上的
    <page>
    (仅适用于Visualforce标签)
  • 空元素如
    <page></page>
    <description></description>
  • 任何不在上述白名单表格中的元素

🔧 Tab Types

🔧 标签类型

Object Tabs

对象标签

  • Purpose: Navigate to custom or standard objects
  • 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>
  • 用途: 导航至自定义或标准对象
  • 文件名决定对象:
    {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:
    {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.
  • 用途: 链接至外部网站或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:
    {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>
  • 用途: 访问自定义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
    <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
  • 使用清晰、描述性的标签名称
  • 为功能选择合适的标签类型
  • 为每个标签选择独特且与上下文相关的motif——不要默认所有标签使用相同图标
  • 考虑用户体验与导航流程
  • 在不同应用中测试标签功能
  • 确保权限与可见性设置正确
  • 遵循一致的命名规范
  • 对象标签文件必须仅包含
    <customObject>true</customObject>
    <motif>
    ——无其他内容
  • Web标签文件必须仅包含:
    <customObject>false</customObject>
    <label>
    <motif>
    <url>
    <urlEncodingKey>
    ,以及可选的
    <description>
    <frameHeight>
    ——无其他内容
  • 切勿包含
    <isHidden>
    <tabVisibility>
    <type>
    <mobileReady>
    或空元素