ChannelLayout defines which Salesforce Knowledge article fields are shared inline, directly within a communication channel, and the order in which they appear. Communication channel layouts support surfaces such as email publishers, Experience Builder sites, and social media publishers, with field selections for an article type or record type.
The layout selects existing article fields; it does not define those fields or record types. In Lightning Knowledge, it also controls whether shared content includes field labels and whether related files are attached to emails. Field selection and email attachment inclusion are separate controls.
Key Elements
| Element | What the Element Controls |
|---|---|
enabledChannels |
Repeatable list of channels where the layout applies. Email is valid. When Lightning Knowledge is enabled, Chat, Messaging, and Social are also valid. |
recordType |
The name of the record type to which the layout applies. Defaults to the primary record type. |
layoutItems |
List of nested ChannelLayoutItem entries. Their sequence determines the order of the shared fields. |
field |
Required within each layoutItems entry. Identifies a field using ArticleTypeName.FieldName or, for Lightning Knowledge, KnowledgeBaseName.FieldName. |
doesExcludeFieldLabels |
Lightning Knowledge setting. true omits field labels; false, the default, includes labels with the field contents. |
doesExcludeFiles |
Lightning Knowledge setting for email attachments. true leaves related files off emails; false, the default, attaches related files. |
Behavior and Constraints
enabledChannels and recordType together determine where the layout applies. Because enabledChannels is repeatable, one layout can apply to multiple channels. Omitting recordType uses the primary record type rather than explicitly selecting another record type.
Field order comes from the sequence of layoutItems, not from the field names. For example, placing an entry for Knowledge.Question before an entry for Knowledge.Answer shares the question field before the answer field.
The two exclusion settings are independent and require Lightning Knowledge:
-
doesExcludeFieldLabels=trueremoves labels, not the selected field contents. With the default value offalse, labels are inserted with the contents. -
doesExcludeFiles=trueprevents related files from being attached to emails. This setting concerns email attachments, not every channel named inenabledChannels.
As a result, the inline field list alone does not describe everything included in an email. A layout can omit field labels while still attaching related files, or include labels while leaving related files off.
Deployment and Retrieval
Channel layout component files use the .channelLayout suffix and belong in the channelLayouts folder of the corresponding package directory. The file-name prefix must match the article type API name. For Lightning Knowledge, it must match the Knowledge object's API name.
In package.xml, use ChannelLayout as the metadata type name. A type entry can use * as its member selection to request channel layout components.
The component requires a label. Each included layoutItems entry also requires its own field value in the documented object-and-field format. Field and record-type references point to separate metadata definitions; the layout does not contain those definitions.
Relationships
The layout references the article's fields and record type through elements. Separately, its file-name prefix associates it with the article type or Knowledge object. That naming rule is not an XML element reference and is distinct from both the field references and the record-type selection.
References
-
CustomField:field, nested withinlayoutItems. -
RecordType:recordType.
Common Questions
Can one ChannelLayout apply to more than one channel?
Yes. Repeat enabledChannels for each applicable channel. Email is valid; Lightning Knowledge also allows Chat, Messaging, and Social.
How do I change the order of Knowledge fields shared in an email?
Change the sequence of the layoutItems entries. That sequence determines the order of the shared fields.
Why are related files attached even though they are not in layoutItems?
Related-file inclusion is separate from inline field selection. In Lightning Knowledge, doesExcludeFiles defaults to false, which attaches related files to emails. Set it to true to leave them off.
How do I share field contents without field labels?
In Lightning Knowledge, set doesExcludeFieldLabels to true. The selected field contents remain included. This does not change the separate email attachment setting.
What should a ChannelLayout file be named?
Use the .channelLayout suffix in the channelLayouts folder. The file-name prefix must match the article type API name or, for Lightning Knowledge, the Knowledge object's API name.