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 NameField TypeDescription
apiVersiondoubleRequired. A double value that binds the view definition to a Salesforce API version.
contentbase64BinaryThe 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.
descriptionstringA description of the view definition.
fullNamestringThe 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.
isProtectedbooleanIndicates whether the view definition is protected (true) or not (false). If true, only this package can reference the view definition directly.
masterLabelstringRequired. Name of the view definition that appears in the Salesforce user interface.
targetTypeViewTargetType (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.

Beta Feature

This feature is not generally available. It is not part of your purchased Services. This feature is subject to change, may be discontinued with no notice at any time in SFDC’s sole discretion, and SFDC may never make this feature generally available. Make your purchase decisions only on the basis of generally available products and features. This feature is made available on an AS IS basis and use of this feature is at your sole risk.