Newer Version Available
CustomPageWebLink
All other custom links are stored as a WebLink in a CustomObject.
Declarative Metadata File Suffix and Directory Location
There is one file per custom link definition, stored in the weblinks folder in the corresponding package directory. The file suffix is .weblink.
Version
CustomPageWebLinks are available in API version 13.0 and later.
Fields
| Field Name | Field Type | Description |
|---|---|---|
| availability | WebLinkAvailability (enumeration of type string) | Required. Indicates whether the link is only available online (online, or if it is also available offline (offline). |
| description | string | A description of the link. |
| displayType | WebLinkDisplayType (enumeration of type string) | Represents how this link is rendered. Valid values:
|
| encodingKey | Encoding (enumeration of type string) | Required. The default encoding setting is Unicode:
UTF-8. Change it if your template requires
data in a different format. This is available if your content source is
URL.Valid values include:
|
| fullName | string | The name used as a unique identifier for API access. The fullName can contain only underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. |
| hasMenubar | boolean | If the openType is newWindow, this field indicates whether to show the browser menu bar for the window (true or not (false). Otherwise, leave this field empty. |
| hasScrollbars | boolean | If the openType is newWindow, this field indicates whether to show the scroll bars for the window (true) or not (false). Otherwise, leave this field empty. |
| hasToolbar | boolean | If the openType is newWindow, this field indicates whether to show the browser toolbar for the window (true) or not (false). Otherwise, leave this field empty. |
| height | int | Height in pixels of the window opened by the link. Required if the openType is newWindow. Otherwise, leave this field empty. |
| isResizable | boolean | If the openType is newWindow, this field indicates whether to allow resizing of the window (true) or not (false). Otherwise, leave this field empty. |
| linkType | WebLinkType (enumeration of type string) | Required. Represents whether the content of the button or link
is specified by a URL, an sControl, a JavaScript code block, or a Visualforce page.
|
| masterLabel | string | The master label for the link. |
| openType | WebLinkWindowType (enumeration of type string) | Required. When the link is clicked, this field specifies the
window style used to display the content. Valid values are:
|
| page | string | If the value of linkType is page, this field represents the Visualforce page. Otherwise, leave this field empty. |
| position | WebLinkPosition (enumeration of type string) | If the openType
is newWindow, this field
indicates how the new window should be displayed. Otherwise, leave
this field empty. Valid values are:
|
| protected | boolean | Required. Indicates whether this component is protected (true) or not (false). Protected components cannot be linked to or referenced by components created in the installing organization. |
| requireRowSelection | boolean | If the openType is massAction, this field indicates whether to require individual row selection to execute the action for this button (true) or not (false). Otherwise, leave this field empty. |
| scontrol | string | If the value of linkType is sControl, this field represents the name of the sControl. Otherwise, leave this field empty. |
| showsLocation | boolean | If the openType is newWindow, this field indicates whether or not to show the browser location bar for the window. Otherwise, leave this field empty. |
| showsStatus | boolean | If the openType is newWindow, this field indicates whether or not to show the browser status bar for the window. Otherwise, leave this field empty. |
| url | string |
If the value of linkType is url, this field represents the URL value. If the value of linkType is javascript, this field represents the JavaScript content. If the value is neither of these, leave this field empty. Content must be escaped in a manner consistent with XML parsing rules. |
| width | int | Width in pixels of the window opened by the link. Required if the openType is newWindow. Otherwise, leave this field empty. |
Declarative Metadata Sample Definition
The following is the definition of a Weblink. For related samples, see HomePageComponent and HomePageLayout.
1<?xml version="1.0" encoding="UTF-8"?>
2<CustomPageWebLink xmlns="http://soap.sforce.com/2006/04/metadata">
3 <availability>online</availability>
4 <displayType>button</displayType>
5 <encodingKey>UTF-8</encodingKey
6 <hasMenubar>false</hasMenubar>
7 <hasScrollbars>true</hasScrollbars>
8 <hasToolbar>false</hasToolbar>
9 <height>600</height>
10 <isResizable>true</isResizable>
11 <linkType>url</linkType>
12 <masterLabel>detailPageButon</masterLabel>
13 <openType>newWindow</openType>
14 <position>none</position>
15 <protected>false</protected>
16 <showsLocation>false</showsLocation>
17 <showsStatus>false</showsStatus>
18 <url>http://google.com</url>
19</CustomPageWebLink>