CompactLayout
A compact layout displays a record’s key fields at a glance in the Salesforce mobile app, Lightning Experience, and in the Outlook and Gmail integrations.
Compact layouts support all field types except:- text area
- long text area
- rich text area
- multi-select picklist
For more information on compact layouts, see Compact Layouts in the Salesforce Help.
File Suffix and Directory Location
Compact layouts are defined as part of the custom object, standard object, or external object definition. See CustomObject for more information.
Version
CompactLayout components are available in API version 29.0 and later. CompactLayout components are available for external objects in API version 42.0 and later.
Fields
Field Name | Field Type | Description |
---|---|---|
fields | string | The fields assigned to the compact layout. Their order represents the prioritization given to them when defining the compact layout. |
label | string | Label that represents the object throughout the Salesforce user interface. |
Declarative Metadata Sample Definition
The following is an example of a CompactLayout component:
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<actionOverrides>
<actionName>Accept</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Clone</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Delete</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Edit</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>List</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>New</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Tab</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>View</actionName>
<type>Default</type>
</actionOverrides>
<compactLayouts>
<fullName>testCompactLayout</fullName>
<fields>textfield__c</fields>
<label>testCompactLayoutLabel</label>
</compactLayouts>
<compactLayoutAssignment>SYSTEM</compactLayoutAssignment>
<deploymentStatus>Deployed</deploymentStatus>
<enableActivities>false</enableActivities>
<enableFeeds>false</enableFeeds>
<enableHistory>false</enableHistory>
<enableReports>false</enableReports>
<fields>
<fullName>textfield__c</fullName>
<externalId>false</externalId>
<label>textfield</label>
<length>255</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
</fields>
<label>customObj</label>
<nameField>
<label>customObj Name</label>
<type>Text</type>
</nameField>
<pluralLabel>customObjs</pluralLabel>
<recordTypes>
<fullName>RT1</fullName>
<active>true</active>
<label>RT1</label>
<compactLayoutAssignment>testCompactLayout</compactLayoutAssignment>
</recordTypes>
<recordTypes>
<fullName>RT2</fullName>
<active>true</active>
<label>RT2</label>
</recordTypes>
<searchLayouts/>
<sharingModel>ReadWrite</sharingModel>
</CustomObject>
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.