Newer Version Available

This content describes an older version of this product. View Latest

WebLink

Represents a custom button or link defined in a custom object.

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Important

This type extends the Metadata metadata type and inherits its fullName field.

Version

WebLinks are available in API version 12.0 and later.

Fields

Field Name Field Type Description
availability WebLinkAvailability (enumeration of type string) Required. Indicates whether the button or link is only available online (online, or if it is also available offline (offline).
description string A description of the button or link.
displayType WebLinkDisplayType (enumeration of type string) Represents how the button or link is rendered. Valid values are:
  • link for a hyperlink
  • button for a button
  • massActionButton for a button attached to a related list
encodingKey Encoding 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:

  • UTF-8—Unicode (UTF-8)
  • ISO-8859-1—General US & Western Europe (ISO-8859–1, ISO-LATIN-1)
  • Shift_JIS—Japanese (Shift-JIS)
  • ISO-2022-JP—Japanese (JIS)
  • EUC-JP—Japanese (EUC-JP)
  • x-SJIS_0213—Japanese (Shift-JIS_2004)
  • ks_c_5601-1987—Korean (ks_c_5601-1987)
  • Big5—Traditional Chinese (Big5)
  • GB2312—Simplified Chinese (GB2312)
  • Big5-HKSCS—Traditional Chinese Hong Kong (Big5–HKSCS)
fullName string The name of the custom button or link with white spaces and special characters escaped for validity. The name can only contain characters, letters, and the underscore (_) character. The name must start with a letter, and can’t end with an underscore or contain two consecutive underscore characters.

Inherited from the Metadata component, this field isn’t defined in the WSDL for this component. It must be specified when creating, updating, or deleting. See create() to see an example of this field specified for a call.

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 custom button or 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.
  • url
  • sControl
  • javascript
  • page
  • flow—Reserved for future use.
masterLabel string Master label for this object. This display value is the internal label that is not translated.
openType WebLinkWindowType (enumeration of type string) Required. When the button or link is clicked, specifies the window style that will be used to display the content. Valid values:
  • newWindow
  • sidebar
  • noSidebar
  • replace
  • onClickJavaScript
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 value of OpenType is newWindow, this field indicates how the new window should be displayed. Otherwise, don’t specify a value. Valid values are:
  • fullScreen
  • none
  • topLeft
protected boolean Required. Indicates whether this subcomponent is protected (true) or not (false). Protected subcomponents can’t be linked to or referenced by components or subcomponents created in the installing organization.
requireRowSelection boolean If the displayType is massActionButton, 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 to show the browser location bar for the window (true) or not (false). Otherwise, leave this field empty.
showsStatus boolean If the openType is newWindow, this field indicates whether to show the browser status bar for the window. Otherwise, leave this field empty.
url string

If the value of linkType is url, this is the URL value. If the value of linkType is javascript, this is the JavaScript content. If the value is neither of these options, 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 button or link.

Required if the openType is newWindow. Otherwise, leave this field empty.

Java Sample

The following Java sample shows sample values for WebLink fields:

1public void WebLinkSample(String name) throws Exception {
2    WebLink WebLink = new WebLink();
3    // name variable represents the full name of the object 
4    // on which to create the WebLink, for example, customObject__c
5    WebLink.setFullName(name + ".googleButton");
6    WebLink.setUrl("http://www.google.com");
7    WebLink.setAvailability(WebLinkAvailability.online);
8    WebLink.setLinkType(WebLinkType.url);
9    WebLink.setEncodingKey(Encoding.fromString("UTF-8"));
10    WebLink.setOpenType(WebLinkWindowType.newWindow);
11    WebLink.setHeight(600);
12    WebLink.setWidth(600);
13    WebLink.setShowsLocation(false);
14    WebLink.setHasScrollbars(true);
15    WebLink.setHasToolbar(false);
16    WebLink.setHasMenubar(false);
17    WebLink.setShowsStatus(false);
18    WebLink.setIsResizable(true);
19    WebLink.setPosition(WebLinkPosition.none);
20    WebLink.setMasterLabel("google");
21    WebLink.setDisplayType(WebLinkDisplayType.link);
22
23    AsyncResult[] asyncResults = metadataConnection.create(new WebLink[]{WebLink});
24    // After the create() call completes, we must poll the results of checkStatus() 
25    // 
26
27}

Wildcard Support in the Manifest File

This metadata type doesn’t support the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.