Edit: This issue turned out to be my mistake. I was deploying to one org and checking Setup in another org. However, since there's not any other questions specifically about deploying only page layout assignments, I'll provide the following info...

You can deploy only a page layout assignment to a profile and do not have to include any other metadata (layout, object, record types) in the deployment for it to work. The example from the original question works if you only want to deploy a page layout assignment for a profile while leaving the rest of the profile unchanged.

Original Question...

I'm trying to figure out how to deploy page layout assignments on a Profile via the Metadata API. Ideally, I want to figure out the minimum I need to deploy as I'm trying to automate distribution across many different orgs.

Assuming I want to assign a custom page layout named Account-Custom Account Layout on the System Administrator profile, I have the following Admin.profile in a metadata package:

<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
        <layout>Account-Custom Account Layout</layout>

The deployment succeeds, but there is no change in the page layout assignments when viewed in Setup in the org.

I thought perhaps I need to also deploy the Account.object and the Account-Custom Account Layout.layout files along with the Profile. Again that deploy succeeds but does not modify the page layout assignments for the System Administrator profile.

I also tried changing the name of the layout in the Profile to a non-existent layout and sure enough, the deployment fails with an error:

layout - no Layout named Account-CCCustom Account Layout found

Has anyone managed to successfully deploy a change to page layout assignments on a profile that could share how you did it?

Is this perhaps something unique to working with the Admin.profile? I can't think of why that would be but I'm grasping at straws at this point.

  • Is the package a managed or unlocked package, or a bundle of unpackaged metadata?
    – David Reed
    Oct 18, 2022 at 21:24
  • Just metadata with a package.xml being deployed, no package Oct 18, 2022 at 21:26
  • OK, I think this was user error on my part. I was deploying to one org and checking Setup in a different org. I'll do some experimentation locally and post an answer shortly. Oct 18, 2022 at 21:37


You must log in to answer this question.

Browse other questions tagged .