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

Get Page Layout Name using Javascript



I have created Custom Home Page component which will be shown on all the pages. It has Javascript file and method in JS file which is executed when page is loaded into browser. I want to know which page layout is loaded in Javascript method. Please suggest me how do I get Page Layout name using javascript in Custom Home Page component.





Hi There,

I think that you should connect via the API and call describeLayout for the sObjectName. From the describeLayout's result you should be able to find out the layout. Please note that you should also find out the record type of the currently edited sObject which might be a little challenging.

Please let me know if you find anything more efficient or better.