function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Diego OlveraDiego Olvera 

How to add a compact layout into a layout through metadata?

Hi, good morning. 
I created a compact layout but I want to add it into a layout.
I edited the standard object "Opportunity" adding:
tags to add fields I made but I don't know where to add these elements in a page layout because some elements are distributed in differents tags like:

Thanks for your time,
Nubes Elite Technologies Pvt. LtdNubes Elite Technologies Pvt. Ltd
Hi Dlego,
You can try this.

Compact layout can be retrieved using objectname . compact layout name api as shown below. here oppcompact is compact layout name.
you can use to build your package.xml

Compact layouts are defined as part of the custom object, standard object, or external object definition.

You need to have it defined in the Object's metadata xml definition as below:

Thank You,
Development | Training | Consulting

Please mark this as solution if your problem is solved.

Rahul Kukreja 5Rahul Kukreja 5
Hey, did you get the solution?
I am having similar kinda problem.
Compact Layout in the target org is deployed but the assignment for the compact layout still shows as System.
I have defined the assignment in the tags <compactLayoutAssignment>compactLayoutName</compactLayoutAssignment> 
can you help me with this?