---
schema_version: "1"
id: ed71ca30056b5dd80a6667821f008828e3f69fa1c6bf5d1f289819b4619c90d1
title: WebLink
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_weblink.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_weblink.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2b0e9b72cd87d2e2d6e1f0afa68ca6f823c0dfb8151724127db6077dd6d8351f
description: Represents a custom button or link defined in a custom object.
---
# WebLink

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

![Important](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note_important.png)

#### Important

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.

This type extends the [Metadata](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm "The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.") metadata type and inherits its fullName field.

## Version

WebLinks are available in API version 12.0 and later.

## Fields

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d1026983e89">Field Name</th>

              <th class="featureTableHeader  " id="d1026983e92">Field Type </th>

              <th class="featureTableHeader  " id="d1026983e95">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">availability</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">WebLinkAvailability (<a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title">enumeration</a> of type string)</td>

              <td class="entry" headers="d1026983e95" data-title="Description">Required. Indicates whether the button or link is only available
                online (<samp class="codeph nolang">online</samp>, or if it is
                also available offline (<samp class="codeph nolang">offline</samp>).</td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">description</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">string</td>

              <td class="entry" headers="d1026983e95" data-title="Description">A description of the button or link.</td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname" id="displaytype"><a name="displaytype"><!-- --></a>displayType</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">WebLinkDisplayType (<a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title">enumeration</a> of type string)</td>

              <td class="entry" headers="d1026983e95" data-title="Description"> Represents how the button or link is rendered. Valid values are: <ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">link</samp> for a
                    hyperlink
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">button</samp> for a
                    button
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">massActionButton</samp> for a
                    button attached to a related list
                  </li>

                </ul>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">encodingKey</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">Encoding</td>

              <td class="entry" headers="d1026983e95" data-title="Description"> Required. The default encoding setting is Unicode: <samp class="codeph xml">UTF-8</samp>. Change it if your template
                requires data in a different format. This is available if your
                content source is URL. <p class="p">Valid values include:</p>
                <ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">UTF-8</samp>—Unicode (UTF-8)
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">ISO-8859-1</samp>—General US &amp; Western Europe
                    (ISO-8859–1, ISO-LATIN-1)
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">Shift_JIS</samp>—Japanese (Shift-JIS)
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">ISO-2022-JP</samp>—Japanese (JIS)
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">EUC-JP</samp>—Japanese (EUC-JP)
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">x-SJIS_0213</samp>—Japanese (Shift-JIS_2004)
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">ks_c_5601-1987</samp>—Korean (ks_c_5601-1987)
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">Big5</samp>—Traditional Chinese (Big5)
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">GB2312</samp>—Simplified Chinese (GB2312)
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">Big5-HKSCS</samp>—Traditional Chinese Hong Kong
                    (Big5–HKSCS)
                  </li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">fullName</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">string</td>

              <td class="entry" headers="d1026983e95" data-title="Description">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.<p class="p">Inherited from the <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm" title="The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.">Metadata</a> component, this
                  field isn’t defined in the WSDL for this component. It must be
                  specified when creating, updating, or deleting. See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_create.htm" title="Deprecated. Adds one or more new metadata components to your organization asynchronously. This call is removed as of API version 31.0 and is available in earlier versions only. Use createMetadata() instead.">create()</a> to see
                  an example of this field specified for a call.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">hasMenubar</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the <a class="xref" href="#opentype"><span class="keyword parmname">openType</span></a> is
                <samp class="codeph nolang">newWindow</samp>, this field
                indicates whether to show the browser menu bar for the window
                (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). Otherwise, leave this field
                empty.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">hasScrollbars</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the <a class="xref" href="#opentype"><span class="keyword parmname">openType</span></a> is
                <samp class="codeph nolang">newWindow</samp>, this field
                indicates whether to show the scroll bars for the window (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). Otherwise, leave this field
                empty.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">hasToolbar</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the <a class="xref" href="#opentype"><span class="keyword parmname">openType</span></a> is
                <samp class="codeph nolang">newWindow</samp>, this field
                indicates whether to show the browser toolbar for the window
                (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). Otherwise, leave this field
                empty.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">height</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">int</td>

              <td class="entry" headers="d1026983e95" data-title="Description">Height in pixels of the window opened by the custom button or
                link. Required if the <a class="xref" href="#opentype"><span class="keyword parmname">openType</span></a> is
                <samp class="codeph nolang">newWindow</samp>. Otherwise, leave
                this field empty.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">isResizable</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the <a class="xref" href="#opentype"><span class="keyword parmname">openType</span></a> is
                <samp class="codeph nolang">newWindow</samp>, this field
                indicates whether to allow resizing of the window (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). Otherwise, leave this field
                empty.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname" id="linktype"><a name="linktype"><!-- --></a>linkType</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">WebLinkType (<a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title">enumeration</a> of type string)</td>

              <td class="entry" headers="d1026983e95" data-title="Description"> 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.<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">url</samp></li>

                  <li class="li"><samp class="codeph nolang">sControl</samp></li>

                  <li class="li"><samp class="codeph nolang">javascript</samp></li>

                  <li class="li"><samp class="codeph nolang">page</samp></li>

                  <li class="li">
                    <samp class="codeph nolang">flow</samp>—Reserved for
                    future use.
                  </li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">masterLabel</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">string</td>

              <td class="entry" headers="d1026983e95" data-title="Description">Master label for this object. This display value is the internal
                label that is not translated.</td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname" id="opentype"><a name="opentype"><!-- --></a>openType</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">WebLinkWindowType (<a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title">enumeration</a> of type string)</td>

              <td class="entry" headers="d1026983e95" data-title="Description">Required. When the button or link is clicked, specifies the
                window style that will be used to display the content. Valid values:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">newWindow</samp></li>

                  <li class="li"><samp class="codeph nolang">sidebar</samp></li>

                  <li class="li"><samp class="codeph nolang">noSidebar</samp></li>

                  <li class="li"><samp class="codeph nolang">replace</samp></li>

                  <li class="li"><samp class="codeph nolang">onClickJavaScript</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">page</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">string</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the value of <a class="xref" href="#linktype"><span class="keyword parmname">linkType</span></a> is
                <samp class="codeph nolang">page</samp>, this field represents
                the Visualforce page. Otherwise, leave this field empty.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">position</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">WebLinkPosition (<a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title">enumeration</a> of type string)</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the value of <span class="keyword parmname">OpenType</span> is <samp class="codeph nolang">newWindow</samp>, this field indicates how
                the new window should be displayed. Otherwise, don’t specify a
                value. Valid values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">fullScreen</samp></li>

                  <li class="li"><samp class="codeph nolang">none</samp></li>

                  <li class="li"><samp class="codeph nolang">topLeft</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">protected</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1026983e95" data-title="Description">Required. <span class="ph" id="field_protected_desc"><a name="field_protected_desc"><!-- --></a>Indicates whether this
                  subcomponent is protected (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). Protected subcomponents can’t be linked to
                  or referenced by components or subcomponents created in the
                  installing organization.</span>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">requireRowSelection</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the <span class="keyword parmname">displayType</span> is <samp class="codeph nolang">massActionButton</samp>, this field
                indicates whether to require individual row selection to execute the
                action for this button (<samp class="codeph java">true</samp>) or
                not (<samp class="codeph java">false</samp>). Otherwise, leave
                this field empty.</td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">scontrol</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">string</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the value of <a class="xref" href="#linktype"><span class="keyword parmname">linkType</span></a> is
                <samp class="codeph nolang">sControl</samp>, this field
                represents the name of the sControl. Otherwise, leave this field
                empty.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">showsLocation</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the <a class="xref" href="#opentype"><span class="keyword parmname">openType</span></a> is
                <samp class="codeph nolang">newWindow</samp>, this field
                indicates whether to show the browser location bar for the window
                (<samp class="codeph java">true</samp>) or not (<samp class="codeph java">false</samp>). Otherwise, leave this field
                empty.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">showsStatus</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1026983e95" data-title="Description">If the <a class="xref" href="#opentype"><span class="keyword parmname">openType</span></a> is
                <samp class="codeph nolang">newWindow</samp>, this field
                indicates whether to show the browser status bar for the window.
                Otherwise, leave this field empty.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">url</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">string</td>

              <td class="entry" headers="d1026983e95" data-title="Description">
                <p class="p">If the value of <a class="xref" href="#linktype"><span class="keyword parmname">linkType</span></a> is
                  <samp class="codeph nolang">url</samp>, this is the URL
                  value. If the value of <a class="xref" href="#linktype"><span class="keyword parmname">linkType</span></a> is
                  <samp class="codeph nolang">javascript</samp>, this is the
                  JavaScript content. If the value is neither of these options,
                  leave this field empty.
                </p>

                <p class="p">Content must be escaped in a manner consistent with XML parsing
                  rules.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1026983e89" data-title="Field Name"><span class="keyword parmname">width</span></td>

              <td class="entry" headers="d1026983e92" data-title="Field Type">int</td>

              <td class="entry" headers="d1026983e95" data-title="Description">Width in pixels of the window opened by the button or
                link.<p class="p">Required if the <a class="xref" href="#opentype"><span class="keyword parmname">openType</span></a> is
                  <samp class="codeph nolang">newWindow</samp>. Otherwise,
                  leave this field empty.
                </p>
              </td>

            </tr>

          </tbody>

        </table>

## Java Sample

The following Java sample shows sample values for WebLink fields:

public void WebLinkSample(String name) throws Exception {
    WebLink WebLink = new WebLink();
    // name variable represents the full name of the object 
    // on which to create the WebLink, for example, customObject\_\_c
    WebLink.setFullName(name + ".googleButton");
    WebLink.setUrl("http://www.google.com");
    WebLink.setAvailability(WebLinkAvailability.online);
    WebLink.setLinkType(WebLinkType.url);
    WebLink.setEncodingKey(Encoding.fromString("UTF-8"));
    WebLink.setOpenType(WebLinkWindowType.newWindow);
    WebLink.setHeight(600);
    WebLink.setWidth(600);
    WebLink.setShowsLocation(false);
    WebLink.setHasScrollbars(true);
    WebLink.setHasToolbar(false);
    WebLink.setHasMenubar(false);
    WebLink.setShowsStatus(false);
    WebLink.setIsResizable(true);
    WebLink.setPosition(WebLinkPosition.none);
    WebLink.setMasterLabel("google");
    WebLink.setDisplayType(WebLinkDisplayType.link);

    AsyncResult\[\] asyncResults = metadataConnection.create(new WebLink\[\]{WebLink});
    // After the create() call completes, we must poll the results of checkStatus() 
    // 

}

## Declarative Metadata Sample Definition

The following is the definition of a WebLink in a custom object. For related samples, see [Declarative Metadata Sample Definition](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_homepagecomponent.htm#HomePageCompenent_example) and [Declarative Metadata Sample Definition](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_homepagelayouts.htm#HomePageLayout_meta_example).

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
....
    <WebLinks\>
        <fullName\>googleButton</fullName\>
        <availability\>online</availability\>
        <displayType\>link</displayType\>
        <encodingKey\>UTF-8</encodingKey\>
        <hasMenubar\>false</hasMenubar\>
        <hasScrollbars\>true</hasScrollbars\>
        <hasToolbar\>false</hasToolbar\>
        <height\>600</height\>
        <isResizable\>true</isResizable\>
        <linkType\>url</linkType\>
        <masterLabel\>google</masterLabel\>
        <openType\>newWindow</openType\>
        <position\>none</position\>
        <protected\>false</protected\>
        <showsLocation\>false</showsLocation\>
        <showsStatus\>false</showsStatus\>
        <url\>http://www.google.com</url\>
        <width\>600</width\>
    </WebLinks\>
....
</CustomObject\>

## 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](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/file_based_zip_file.htm).

- [← Previous](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_validationformulas.htm "ValidationRule")
- [Next →](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_field_types.htm "Metadata Field Types")

#### See Also

- [HomePageComponent](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_homepagecomponent.htm "Represents the metadata associated with a home page component. You can customize the Home tab in Salesforce Classic to include components such as sidebar links, a company logo, a dashboard snapshot, or custom components that you create. Use to create, update, or delete home page component definitions.")
- [HomePageLayout](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_homepagelayouts.htm "Represents the metadata associated with a home page layout. You can customize home page layouts and assign the layouts to users based on their user profile.")
- [CustomPageWebLink](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/custompageweblink.htm "Represents a custom link defined in a home page component.")