Lightning – Fix Losing Lightning Page’s App/Record Type/Profile Level Assignments After Deploying

If, like me, you're not making a lightning page an org or app default, you've probably got a LOT of boxes to check, in order to make sure every combination of App, Record Type and Profile gets the access they need. Especially because there is no 'check all' option, or way to indicate that record types are the only thing I care about.

I created my lightning page, activated it and assigned it, all in Sandbox. When I pushed it to Production, all those assignments disappeared. I did include all profiles in my changeset.

Is there a way to preserve those assignments in deployments?

Best Answer

The lightning app metadata (src/applications/YourAppName.app) contains the overrides for the app as a whole and also the per recordtype & profile assignments.

<CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata">
    <actionOverrides>
        <actionName>View</actionName>
        <comment>Action override created by Lightning App Builder during activation.</comment>
        <content>My_Page</content>
        <formFactor>Large</formFactor>
        <skipRecordTypeSelect>false</skipRecordTypeSelect>
        <type>Flexipage</type>
        <pageOrSobjectType>My_Object__c</pageOrSobjectType>
    </actionOverrides>
    <brand>
        <headerColor>#106550</headerColor>
        <logo>myLogo</logo>
        <logoVersion>1</logoVersion>
        <shouldOverrideOrgTheme>false</shouldOverrideOrgTheme>
    </brand>
    <formFactors>Large</formFactors>
    <isNavAutoTempTabsDisabled>false</isNavAutoTempTabsDisabled>
    <isNavPersonalizationDisabled>true</isNavPersonalizationDisabled>
    <label>My Awesome Application</label>
    <navType>Standard</navType>
    <profileActionOverrides>
        <actionName>View</actionName>
        <content>MyFlexipageName</content>
        <formFactor>Large</formFactor>
        <pageOrSobjectType>My_RecordTypedObject__c</pageOrSobjectType>
        <recordType>My_RecordTypedObject__c.RecordType1</recordType>
        <type>Flexipage</type>
        <profile>Admin</profile>
    </profileActionOverrides>
    <profileActionOverrides>
        <actionName>View</actionName>
        <content>MyFlexipageName</content>
        <formFactor>Large</formFactor>
        <pageOrSobjectType>My_RecordTypedObject__c</pageOrSobjectType>
        <recordType>My_RecordTypedObject__c.RecordType1</recordType>
        <type>Flexipage</type>
        <profile>Standard</profile>
    </profileActionOverrides>

The object level flexipage override is similarly contained in the objectName.object metadata for each object.

<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <!-- snip -->
    <actionOverrides>
        <actionName>Tab</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>View</actionName>
        <comment>Action override updated by Lightning App Builder during activation.</comment>
        <content>My_Page</content>
        <formFactor>Large</formFactor>
        <skipRecordTypeSelect>false</skipRecordTypeSelect>
        <type>Flexipage</type>
    </actionOverrides>
    <allowInChatterGroups>false</allowInChatterGroups>

The profile settings themselves do not contain this flexipage assignment metadata. The profile settings does include the home tab override per profile.

<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
    <profileActionOverrides>
        <actionName>Tab</actionName>
        <content>MyFlexipage_For_Home_Tab</content>
        <formFactor>Large</formFactor>
        <pageOrSobjectType>standard-home</pageOrSobjectType>
        <type>Flexipage</type>
    </profileActionOverrides>

This can all be retrieved and deployed via the metadata API, so it should work the same in Change Sets.

Update: Looking at the documentation for the ProfileActionOverrides, it looks like other profile based overrides can be selected when creating the Change Set that aren't available in a packaging scenario.

ProfileActionOverrides aren’t supported in packaging. They are supported in change sets, but you have to add them manually.

Can you confirm which elements you included as part of the change set?

Related Topic