---
schema_version: "1"
id: 88b043640150a3479183e47bf1a768e7169adbef513fc985aaac441334fda26a
title: ConnectApi.ActionLinkDefinitionInput
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_connectapi_input_action_link_definition.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_action_link_definition.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 31dc4d2a57ac3595e0f69754d0ada077ab63df0ca8aeb0aa162253ad5c3285d1
description: The definition of an action link. An action link is a button on a feed element. Clicking an action link can take a user to a Web page, initiate a file download, or invoke an API call to Salesforce or to an external server. An action link includes a URL and an HTTP method, and can include a request body and header information, such as an OAuth token for authentication. Use action links to integrate Salesforce and third-party services into the feed so that users can drive productivity and accelerate innovation.
---
# ConnectApi.ActionLinkDefinitionInput

The definition of an action link. An action link is a button on a feed element. Clicking an action link can take a user to a Web page, initiate a file download, or invoke an API call to Salesforce or to an external server. An action link includes a URL and an HTTP method, and can include a request body and header information, such as an OAuth token for authentication. Use action links to integrate Salesforce and third-party services into the feed so that users can drive productivity and accelerate innovation.

## Usage

You can use context variables in the actionUrl, headers, and requestBody properties. Use context variables to pass information about the user who executed the action link to your server-side code. Salesforce substitutes the value when the action link is executed.

The available context variables are:

| Context Variable | Description |
| --- | --- |
| {!actionLinkId} | The ID of the action link the user executed. |
| {!actionLinkGroupId} | The ID of the action link group containing the action link the user executed. |
| {!communityId} | The ID of the site in which the user executed the action link. The value for your internal org is the empty key "000000000000000000". |
| {!communityUrl} | The URL of the site in which the user executed the action link. The value for your internal org is empty string "". |
| {!orgId} | The ID of the org in which the user executed the action link. |
| {!userId} | The ID of the user that executed the action link. |

<table class="featureTable sort_table" summary="">
          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader vertical-align-top " id="d536204e134">Property</th>
              <th class="featureTableHeader vertical-align-top " id="d536204e136">Type</th>
              <th class="featureTableHeader vertical-align-top " id="d536204e138">Description</th>
              <th class="featureTableHeader vertical-align-top " id="d536204e140">Required or Optional</th>
              <th class="featureTableHeader vertical-align-top " id="d536204e142">Available Version</th>
            </tr>
          </thead>
          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">actionType</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type"><a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/connectAPI_enums.htm#ActionLinkTypeEnum"><samp class="codeph apex_code">ConnectApi.​ActionLinkType</samp></a></td>
              <td class="entry" headers="d536204e138" data-title="Description">Defines the type of action link. Values are:<ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">Api</samp>—The action link calls a synchronous API at the action URL. Salesforce sets the status to <samp class="codeph nolang">SuccessfulStatus</samp> or <samp class="codeph nolang">FailedStatus</samp> based on the HTTP status code returned by your server.
                  </li>
                  <li class="li">
                    <samp class="codeph nolang">ApiAsync</samp>—The action link calls an asynchronous API at the
                    action URL. The action remains in a <samp class="codeph nolang">PendingStatus</samp> state until a third party makes a request to <samp class="codeph nolang">/connect/action-links/{actionLinkId}</samp> to set the
                    status to <samp class="codeph nolang">SuccessfulStatus</samp> or <samp class="codeph nolang">FailedStatus</samp> when the asynchronous operation is
                    complete.
                  </li>
                  <li class="li">
                    <samp class="codeph nolang">Download</samp>—The action link downloads a file from the action URL.
                  </li>
                  <li class="li">
                    <samp class="codeph nolang">Ui</samp>—The action link takes the user to a web page at the action URL.
                  </li>
                </ul>
                <p class="p">Use <samp class="codeph nolang">Ui</samp> if you need to load a page before the user performs an action, for example, to have the user provide input or view something before the action happens.</p>
                Invoking <samp class="codeph nolang">ApiAsync</samp> action links from an app
                requires a call to set the status. However, there isn’t currently a way to set the
                status of an action link using Apex. To set the status, use Connect REST API. See
                the Action Link resource in the <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/" target="_blank" title="HTML (New Window)">Connect
                  REST API Developer Guide</a>for more information.
              </td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Required <p class="p">Can be defined in an action link template.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">actionUrl</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type">String</td>
              <td class="entry" headers="d536204e138" data-title="Description">The action link URL. For example, a <samp class="codeph nolang">Ui</samp> action link URL is a Web page. A <samp class="codeph nolang">Download</samp> action link URL is a link to the file to download. <samp class="codeph nolang">Ui</samp> and <samp class="codeph nolang">Download</samp> action link URLs are provided to clients. An <samp class="codeph nolang">Api</samp> or <samp class="codeph nolang">ApiAsync</samp> action link URL is a REST resource. <samp class="codeph nolang">Api</samp> and <samp class="codeph nolang">ApiAsync</samp> action link URLs aren’t provided to clients. Links to Salesforce can be relative. All other links must be absolute and start with <samp class="codeph nolang">https://</samp>. <strong class="ph b">Tip:</strong> To avoid issues due to upgrades or changing functionality in your API, we recommend using a versioned API for <samp class="codeph nolang">actionUrl</samp>, for example, <span class="ph filepath">https://www.example.com/​api/v1/exampleResource</span>. If your API isn’t versioned, you can use the <samp class="codeph nolang">expirationDate</samp> property of the <samp class="codeph apex_code">ConnectApi.ActionLinkGroup​DefinitionInput</samp> class to avoid issues due to upgrades or changing functionality in your API.</td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Required<p class="p">Can be defined in an action link template.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">excludedUserId</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type">String</td>
              <td class="entry" headers="d536204e138" data-title="Description">ID of a single user to exclude from performing the action. If you specify an <samp class="codeph nolang">excludedUserId</samp>, you can’t specify a <samp class="codeph nolang">userId</samp>.</td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Optional <p class="p">Can be defined in an action link template using the <span class="keyword parmname">User
                    Visibility</span> and <span class="keyword parmname">Custom User Alias</span>
                  fields.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">groupDefault</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type">Boolean</td>
              <td class="entry" headers="d536204e138" data-title="Description">
                <samp class="codeph nolang">true</samp> if this action is the default action link in the action link group; <samp class="codeph nolang">false</samp> otherwise. There can be only one default action link per action link group. The default action link gets distinct styling in the Salesforce UI.
              </td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Optional <p class="p">Can be defined in an action link template.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">headers</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type">
                <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list" title="Contains methods for the List collection type.">List</a>&lt;<a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_request_header.htm#apex_connectapi_input_request_header" title="An HTTP request header name and value pair."><samp class="codeph apex_code">ConnectApi.​RequestHeader​Input</samp></a>&gt;
              </td>
              <td class="entry" headers="d536204e138" data-title="Description">The request headers for the <samp class="codeph nolang">Api</samp> and <samp class="codeph nolang">ApiAsync</samp> action link types.<p class="p">See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_features_action_links_overview.htm" target="_blank">Action Links Overview, Authentication, and Security</a>.</p>
              </td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Optional <p class="p">Can be defined in an action link template.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">labelKey</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type">String</td>
              <td class="entry" headers="d536204e138" data-title="Description">Key for the set of labels to show in the user interface. A set includes labels for these states: NewStatus, PendingStatus, SuccessStatus, FailedStatus. For example, if you use the <samp class="codeph nolang">Approve</samp> key, you get these labels: Approve, Pending, Approved, Failed.
                <p class="p">For a complete list of keys and labels, see <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/connect_appendices_action_links_labels.htm" target="_blank">Action Links Labels</a>.</p>
                <p class="p">If none of the predefined labels work for your action link, use a custom label. To use a custom label, create an action link template. See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/action_link_group_template_create.htm" target="_blank">Create Action Link Templates</a>.</p>
              </td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Required<p class="p">Can be defined in an action link template.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">method</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type"><a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/connectAPI_enums.htm#RequestMethodEnum"><samp class="codeph apex_code">ConnectApi.​HttpRequest​Method</samp></a></td>
              <td class="entry" headers="d536204e138" data-title="Description">One of these HTTP methods:<ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">HttpDelete</samp>—Returns HTTP 204 on success. Response body or output class is empty.
                  </li>
                  <li class="li">
                    <samp class="codeph nolang">HttpGet</samp>—Returns HTTP 200 on success.
                  </li>
                  <li class="li">
                    <samp class="codeph nolang">HttpHead</samp>—Returns HTTP 200 on success. Response body or output class is empty.
                  </li>
                  <li class="li">
                    <samp class="codeph nolang">HttpPatch</samp>—Returns HTTP 200 on success or HTTP 204 if the response body or output class is empty.
                  </li>
                  <li class="li">
                    <samp class="codeph nolang">HttpPost</samp>—Returns HTTP 201 on success or HTTP 204 if the response body or output class is empty. Exceptions are the batch posting resources and methods, which return HTTP 200 on success.
                  </li>
                  <li class="li">
                    <samp class="codeph nolang">HttpPut</samp>—Return HTTP 200 on success or HTTP 204 if the response body or output class is empty.
                  </li>
                </ul>
              </td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Required <p class="p">Can be defined in an action link template.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">requestBody</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type">String</td>
              <td class="entry" headers="d536204e138" data-title="Description">The request body for <samp class="codeph apex_code">Api</samp> action links. Escape
                quotation mark characters in the <samp class="codeph nolang">requestBody</samp>
                value. </td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Optional<p class="p">Can be defined in an action link template.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">requires​Confirmation</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type">Boolean</td>
              <td class="entry" headers="d536204e138" data-title="Description">
                <samp class="codeph nolang">true</samp> to require the user to confirm the action; <samp class="codeph nolang">false</samp> otherwise.
              </td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Required<p class="p">Can be defined in an action link template.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
            <tr>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property"><samp class="codeph apex_code">userId</samp></td>
              <td class="entry" headers="d536204e136" data-title="Type">String</td>
              <td class="entry" headers="d536204e138" data-title="Description">The ID of the user who can execute the action. If not specified or <samp class="codeph nolang">null</samp>, any user can execute the action. If you specify a <samp class="codeph nolang">userId</samp>, you can’t specify an <samp class="codeph nolang">excludedUserId</samp>.</td>
              <td class="entry" headers="d536204e140" data-title="Required or Optional">Optional<p class="p">Can be defined in an action link template using the <span class="keyword parmname">User
                    Visibility</span> and <span class="keyword parmname">Custom User Alias</span>
                  fields.</p>
              </td>
              <td class="entry" headers="d536204e134 d536204e142" data-title="Property">33.0</td>
            </tr>
          </tbody>
        </table>

#### See Also

- [ConnectApi.ActionLinkGroupDefinitionInput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_action_link_group_definition.htm "The definition of an action link group. All action links must belong to a group. Action links in a group are mutually exclusive and share some properties. Define standalone actions in their own action group.")