function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bikram K BhuyanBikram K Bhuyan 

Accessing the page layout and its properties programmatically in Apex.

Hello Experts,

We are developing a custom lighting web component where we have a requirement to show a set of custom action buttons. The same set of custom buttons are also added to the page layout of the custom object. We want show the buttons in the lightning web component only if those are added to the page layout. In other words - if the user removes any of the custom buttons from the page layout those options should be hidden from the lighting web component action button list as well.

So I am trying to see if I can access the page layout and its associted properties using Apex.

Could you please suggest if you have solved these type of requirements in any of your projects?

Thanks,
Bikram.
Jessica RiffeJessica Riffe
I have not done this personally, but yes, you can do it from the Metadata API. 
Documentation Link (https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_layouts.htm)

Here is another link to explore of someone not entirely doing your use case, but maybe something to get you started down the right path.
https://medium.com/@charlie_77818/using-to-apex-metadata-api-to-recreate-standard-layouts-9ab1de200640
akshaya vengalaakshaya vengala
showbox (https://apkmist.com/showbox-apk/)
This app allows you to simplify the display of the content you need.