This feed item contains one action link group with one visible action link,
Join.
Create action link templates in Setup to instantiate action link groups with common properties. You can package templates and distribute them to other Salesforce organizations.
Specify binding variables in the template and set the values of the variables when you instantiate the action link group. For example, use a binding variable for the API version number, a user ID, or an OAuth token.
You can also specify context variables in the templates. When a user executes the action link, Salesforce provides values for these variables, such as who executed the link and in which organization.
To instantiate the action link group, call the ActionLinks.createActionLinkGroupDefinition(communityId, actionLinkGroup) method. Specify the template ID and the values for any binding variables defined in the template.
Specify the action link type in the actionType property when you define an action link.
When you define an action link, specify a URL (actionUrl) and the HTTP headers (headers) required to make a request to that URL.
If an external resource requires authentication, include the information wherever the resource requires.
If a Salesforce resource requires authentication, you can include OAuth information in the HTTP headers or you can include a bearer token in the URL.
Use context variables to pass information about the user who executed the action link and the context in which it was invoked into the HTTP request made by invoking an action link. You can use context variables in the actionUrl, headers, and requestBody properties of the Action Link Definition Input request body or ConnectApi.ActionLinkDefinitionInput object. You can also use context variables in the Action URL, HTTP Request Body, and HTTP Headers fields of action link templates. You can edit these fields, including adding and removing context variables, after a template is published.
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 community in which the user executed the action link. The value for your internal organization is the empty key "000000000000000000". |
{!communityUrl} | The URL of the community in which the user executed the action link. The value for your internal organization is empty string "". |
{!orgId} | The ID of the organization in which the user executed the action link. |
{!userId} | The ID of the user that executed the action link. |
To avoid issues due to upgrades or changing functionality in your API, we recommend using versioning when defining action links. For example, the actionUrl property in the ConnectApi.ActionLinkDefinitionInput Class should look like https://www.example.com/api/v1/exampleResource.
You can use templates to change the values of the actionUrl, headers, or requestBody properties, even after a template is distributed in a package. For example, if you release a new API version that requires new inputs, an admin can change the inputs in the action link template in Setup and even action links already associated with a feed element will use the new inputs. However, you can’t add new binding variables to a published action link template.
If your API isn’t versioned, you can use the expirationDate property of the ConnectApi.ActionLinkGroupDefinitionInput Class to avoid issues due to upgrades or changing functionality in your API. See Set the Action Link Group Expiration Time.
Use the Action Link Diagnostic Information method (ActionLinks.getActionLinkDiagnosticInfo(communityId, actionLinkId)) to return status codes and errors from executing Api action links. Diagnostic info is given only for users who can access the action link.
Action links use a predefined set of localized labels specified in the labelKey property of the ConnectApi.ActionLinkDefinitionInput Class request body and the Label field of an action link template.
For a list of labels, see Action Links Labels.