ViewDefinition

Represents a view definition on a Slack app. This type extends the MetadataWithContent metadata type and inherits its content and fullName fields.

Declarative Metadata File Suffix and Directory Location

The file suffix is .view for the view definition. The accompanying metadata file is named YourViewName.view-meta.xml. The files are stored in the viewdefinitions folder in the corresponding package directory.

Version

Slack apps are available in API version 54.0 and later.

Special Access Rules

To use this metadata type, your org must have Slack capabilities and packaging enabled.

Fields

Field Name Field Type Description
apiVersion double Required. A double value that binds the view definition to a Salesforce API version.
content base64Binary The page content. Base 64-encoded binary data. Prior to making an API call, client applications must encode the binary attachment data as base64. Upon receiving a response, client applications must decode the base64 data to binary. This conversion is usually handled for you by a SOAP client. This field is inherited from the MetadataWithContent component.
description string A description of the view definition.
fullName string The developer name used as a unique identifier for API access. 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. This field is inherited from the Metadata component.
isProtected boolean Indicates whether the view definition is protected (true) or not (false). If true, only this package can reference the view definition directly.
masterLabel string Required. Name of the view definition that appears in the Salesforce user interface.
targetType ViewTargetType (enumeration of type string) Required. Specifies where the view can be used. Valid value is slack.

Declarative Metadata Sample Definition

This is the hello.view-meta.xml metadata file.

<?xml version="1.0" encoding="UTF-8"?>
<ViewDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isProtected>false</isProtected>
    <masterLabel>Hello World Slack App</masterLabel>
    <targetType>slack</targetType>
</ViewDefinition>

Here's the corresponding hello.view definition. This view uses the SlackApp example with the slash command dispatcher. See Define a View.

description: "Say Hello Example"
schema:
  properties:
    name:
      type: string
      required: true
components:
  - definition: modal
    properties:
      title: "Hello {!view.properties.name}"
    components:
      - definition: section
        properties:
          text: "You just said Hello from Apex!"

Wildcard Support in the Manifest File

This metadata type supports 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.