When you check the Metadata.Operations.retrieve method, It requires you to know prior the fullname for the page layout you want to retrieve, and the Layout object it's not available with regular SOQL, is there a way to findout all layouts available with APEX and not using the tooling REST API?

1 Answer 1


The Tooling API is your friend here.

You can make a call to /services/data/v33.0/tooling/query/ and query the layouts per object. For example:


There may be other ways that are simpler, but this is the one that comes to mind.

PS: If you're in Classic, you can use your SessionId to authenticate. In Lightning, you may need to get creative.

  • 1
    Named credentials in Lightning. Commented Nov 28, 2018 at 19:16
  • 3
    If this is the only way to get that data. I don't think the question of best practice comes to picture. Best practices are when you have alternatives, Salesforce has not released any API for page layouts yet, hopefully, in future it does. Commented Nov 28, 2018 at 19:22
  • 2
    @ekiim, I agree 100% with Pranay. It's the best practice because it is the only practice. Commented Nov 28, 2018 at 19:23
  • 1
    @ekiim This is a bit of a limitation of the current implementation. Salesforce has said they'd make more operations available in the future, so we can just hope that getting a list of page layouts is one of them.
    – sfdcfox
    Commented Nov 28, 2018 at 19:23
  • 1
    I see, well, I guess we can pin this question, @SebastianKessel edits and expand why It's currently not possible, (with some info on this comments), I think, this could be a common question. I suppose.
    – ekiim
    Commented Nov 28, 2018 at 19:25

You must log in to answer this question.

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