[SalesForce] How to activate a Lightning Page via metadata

I am deploying a solution which includes Lightning Pages and I would like to programmatically activate the FlexiPage in the target org when it is deployed.

In the Configure Lightning Experience documentation it describes Activation on Save or performed later using the Activation button.

  1. Is it possible to programmatically activate a Lightning Page as the default for an object or must it be activated manually after deployment?
  2. Where is the default Lightning Page per object stored in metadata?

enter image description here

Best Answer

[This] can be achieved by using the following in an applications/AppName.app metadata file:

<profileActionOverrides>
    <actionName>View</actionName>
    <content>PageName</content>
    <formFactor>Large</formFactor>
    <pageOrSobjectType>Account</pageOrSobjectType>
    <recordType>Account.RecordType</recordType>
    <type>Flexipage</type>
    <profile>ProfileName</profile>
</profileActionOverrides>

Courtesy of Stephen Titley, https://success.salesforce.com/ideaView?id=0873A000000cLetQAE

And also this article: Activate Lightning Record Page via Metadata API

The docs say "The only valid values are record-home and standard-home" for <pageOrSobjectType>. You can put an sObject in there; if you haven't sub-classed record type (you are using master) you can just remove the <recordType /> element.