Newer Version Available
CompactLayout
Represents the metadata associated with a compact
layout.
This type extends the Metadata
metadata type and inherits its fullName field.
A compact layout displays a record’s key fields at a glance in both the Salesforce mobile app and Lightning Experience.
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:
1<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
2 <actionOverrides>
3 <actionName>Accept</actionName>
4 <type>Default</type>
5 </actionOverrides>
6 <actionOverrides>
7 <actionName>Clone</actionName>
8 <type>Default</type>
9 </actionOverrides>
10 <actionOverrides>
11 <actionName>Delete</actionName>
12 <type>Default</type>
13 </actionOverrides>
14 <actionOverrides>
15 <actionName>Edit</actionName>
16 <type>Default</type>
17 </actionOverrides>
18 <actionOverrides>
19 <actionName>List</actionName>
20 <type>Default</type>
21 </actionOverrides>
22 <actionOverrides>
23 <actionName>New</actionName>
24 <type>Default</type>
25 </actionOverrides>
26 <actionOverrides>
27 <actionName>Tab</actionName>
28 <type>Default</type>
29 </actionOverrides>
30 <actionOverrides>
31 <actionName>View</actionName>
32 <type>Default</type>
33 </actionOverrides>
34 <compactLayouts>
35 <fullName>testCompactLayout</fullName>
36 <compactLayoutItems>textfield__c</compactLayoutItems>
37 <label>testCompactLayoutLabel</label>
38 </compactLayouts>
39 <compactLayoutAssignment>SYSTEM</compactLayoutAssignment>
40 <deploymentStatus>Deployed</deploymentStatus>
41 <enableActivities>false</enableActivities>
42 <enableFeeds>false</enableFeeds>
43 <enableHistory>false</enableHistory>
44 <enableReports>false</enableReports>
45 <fields>
46 <fullName>textfield__c</fullName>
47 <externalId>false</externalId>
48 <label>textfield</label>
49 <length>255</length>
50 <required>false</required>
51 <type>Text</type>
52 <unique>false</unique>
53 </fields>
54 <label>customObj</label>
55 <nameField>
56 <label>customObj Name</label>
57 <type>Text</type>
58 </nameField>
59 <pluralLabel>customObjs</pluralLabel>
60 <recordTypes>
61 <fullName>RT1</fullName>
62 <active>true</active>
63 <label>RT1</label>
64 <compactLayoutAssignment>testCompactLayout</compactLayoutAssignment>
65 </recordTypes>
66 <recordTypes>
67 <fullName>RT2</fullName>
68 <active>true</active>
69 <label>RT2</label>
70 </recordTypes>
71 <searchLayouts/>
72 <sharingModel>ReadWrite</sharingModel>
73</CustomObject>