I know it's possible to retrieve page layout metadata natively from Salesforce however I'm trying to grab the page layout assigned to a particular profile and in order to do that I need to grab the Profile/ProfileLayout.

Ex. To grab metadata info on the page layout I pass in.

List<Metadata.Metadata> layouts = 
                             new List<String> {'Account-Account Layout'});

My question is how to I do this for Profile/ProfileLayout/ProfileLayoutAssignments "Natively in Salesforce"

  • 4
    Have you considered the User Interface API instead?
    – Adrian Larson
    Commented Jul 27, 2018 at 21:40
  • Yeah I'm not trying to make it more complicated than it needs to be. I need to create a viable replacement for a detail page layout in Lightning Experience and want to grab the running user's assigned layout instead of statically setting it. Commented Jul 27, 2018 at 21:52
  • 1
    @MichaelYocca That's the explicit purpose of the UI API. Your objective is pretty much its designed-in use case, and the Lightning Experience uses it for that purpose.
    – David Reed
    Commented Jul 27, 2018 at 22:12
  • Yeah I realize it is the use case of the UI API but seems somewhat overkill since my solution is residing in lightning and not on a external web application. I can accomplish what I am trying to do already I just don't want to statically set the page layout to grab the sections/fields from Commented Jul 27, 2018 at 22:14
  • @DavidReed I gave it a try and the UI API was pretty simple to setup and play around with. Thank you! Adrian Larson Thank you as well Commented Jul 28, 2018 at 22:39

2 Answers 2


First, use the Metadata API to Retrieve() the desired Profile. Look in the Profile XML file for the layoutAssignments element. It will look something like this:


This defines the junction between the object, record type, and layout for that profile. You can find the given layout with another Retrieve() call. Hope that helps.


Just to perpetuate from my comments (since it seems to have worked).

You should use the UI API for this implementation. It is designed for what you are trying to do, and should be easier to get running than the Metadata API.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .