3

I'm looking to get the details about the current page layout in Apex. In a custom visualforce page, I'd like to be able to add the "Edit Layout" link that a standard page has and I'd also like to be able to get the details about which related lists are present on the current page layout. I've found some information about calling this through the API, but haven't found anything that works directly in Apex...

1 Answer 1

4

Page layouts are only available through the Metadata API, which is not available in apex. There is a pretty exhaustive post here on StackExchange and an interesting Github repo for accessing the metadata API from SE superstar Andrew Fawcett:

Has anyone, ever, successfully invoked the Metadata API from within Apex?

4
  • Unfortunate. I haven't dealt with anything like this before, so my current barrier to entry is quite high. Any way you could help guide me? Commented Oct 16, 2013 at 0:19
  • 1
    Honestly, I couldn't since it's not something I've ever attempted
    – greenstork
    Commented Oct 16, 2013 at 2:49
  • Fair enough, I appreciate the link and confirmation, though! Commented Oct 16, 2013 at 3:08
  • 1
    Thanks @greenstork for the kind words. :-) Nathan, please take a look at the Retrieve Demo (selecting Layout as the Metadata Type from the dropdown) in the Apex Metadata API library for how to do this. You can deploy the library directly into your org (by clicking the Deploy to Salesforce link in the Readme at the top). github.com/financialforcedev/apex-mdapi#metadata-retrieve-demo Commented Oct 16, 2013 at 8:08

You must log in to answer this question.

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