HomePageComponent defines a component used to customize the Home tab in Salesforce Classic, such as sidebar links, HTML content, or a Visualforce area. Metadata API can create, update, and delete these definitions.
A component definition is separate from HomePageLayout. The component defines its content and display settings; the layout references the components it uses. Creating a component does not establish which layouts use it or which users can access its content.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The component's identity, inherited from Metadata. Required when creating, updating, or deleting through Metadata API. The name must start with a letter, cannot end with an underscore, and cannot contain consecutive underscores. |
pageComponentType |
Required. Selects the content model: links, htmlArea, imageOrNote, or visualforcePage. |
body |
The text body of an HTML page component. Its XML representation must remain well-formed. |
links |
For pageComponentType set to links, a repeatable collection containing zero or more custom page-link names, not a single scalar string. |
page |
For a Visualforce Area component, the associated Visualforce page's API name, not its record ID. |
height |
Required for Visualforce Area components. Sets the component height in pixels. |
showLabel |
Applies only to Visualforce Area components. true displays a label; false does not. |
showScrollbars |
Applies only to Visualforce Area components. true displays scrollbars; false does not. |
width |
Applies only to HTML and Visualforce Area components. Salesforce documents narrowComponents and wideComponents. A tooling schema exposes different values; see Documentation Inconsistencies. |
Behavior and Constraints
Interpret the content fields according to pageComponentType. A links component uses links, an HTML Area component uses body, and a Visualforce Area component uses page and requires height. Do not treat all fields as interchangeable across component modes.
For a Visualforce Area component, page identifies the Visualforce page by API name. This is distinct from fullName, which identifies the Home page component itself. The label and scrollbar settings affect only the Visualforce Area mode.
The component's width describes whether it is narrow or wide; it does not establish layout usage. A HomePageLayout separately references components through its own narrowComponents and wideComponents elements.
Deployment and Retrieval
In a Metadata API package directory, component files use the .homePageComponent suffix and reside in homepagecomponents. For example, a component named CompanyLinks is represented by homepagecomponents/CompanyLinks.homePageComponent.
HomePageComponent supports the * wildcard in the package.xml manifest. Use the exact type name HomePageComponent when selecting these definitions for retrieval.
The dependencies to account for depend on the component mode. A Visualforce Area component can reference an ApexPage; a links component can reference custom link definitions. Layout and tab references point in the other direction: those assets reference the component. Deploying the component definition alone does not configure those incoming references or establish user access.
Malformed body content can cause an XML save error before content rendering is involved. When HTML is represented as escaped text inside body, a raw less-than character can be parsed as markup. Encode a literal less-than character as < in XML text. The reported example and its diagnostic limits are described under Reported Issues.
Relationships
Content dependencies and usage references are separate. A layout can reference a component that then references a Visualforce page or custom links. Actual impact depends on the references present. For links, Salesforce describes the supported categories as CustomPageWebLink and ObjectWebLink; the metadata reference relationships below identify CustomPageWebLink and WebLink.
References
-
ApexPage:page. -
CustomPageWebLink:links. -
WebLink:links.
Referenced By
-
CustomTab:splashPageLink. -
HomePageLayout:narrowComponents,wideComponents.
Documentation Inconsistencies
The width enumeration has two exposed representations. Salesforce's Metadata API documentation lists narrowComponents and wideComponents, while a tooling element schema exposes narrow and wide. Do not assume these representations are interchangeable when diagnosing validation or XML serialization problems, where settings are converted into XML text.
The exposed scalar type for links can also be misleading. Although a tooling schema labels it as a string, the Metadata API definition is string[]: a repeatable collection of zero or more custom page-link names.
Reported Issues
- An HTML Area component save reportedly failed with "The content of elements must consist of well-formed character data or markup" because a raw less-than character was parsed as markup. In the 2013 report, the character appeared in a loop comparison inside otherwise escaped
bodycontent. This was an XML serialization diagnosis, not evidence that embedded scripts are supported at runtime. See the HTML Area XML save-error discussion.
Common Questions
Does deploying a HomePageComponent add it to a Home page layout?
No. The component defines content and display settings. HomePageLayout separately references components through narrowComponents or wideComponents.
What fields does a Visualforce Home page component need?
Set pageComponentType to visualforcePage, identify the Visualforce page by API name in page, and provide the required height in pixels. showLabel and showScrollbars apply only to this component mode.
Can I retrieve all HomePageComponent definitions with a wildcard?
Yes. HomePageComponent supports * in package.xml. Metadata API files use the .homePageComponent suffix in the homepagecomponents directory.
Why does my HTML Area component fail with a well-formed character data error?
Malformed XML text in body can cause this error. A reported case involved a raw less-than character inside otherwise escaped content. That diagnosis concerns XML parsing, not whether the embedded content can run.