{"id":5877,"date":"2022-07-04T04:53:59","date_gmt":"2022-07-04T04:53:59","guid":{"rendered":"https:\/\/studysection.com\/blog\/?p=5877"},"modified":"2022-07-04T05:33:05","modified_gmt":"2022-07-04T05:33:05","slug":"get-the-page-layout-of-any-object-in-lightning-web-components","status":"publish","type":"post","link":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/","title":{"rendered":"Get the Page Layout of any object in Lightning Web Components"},"content":{"rendered":"<p>Suppose you want to create a lightning-record-edit-form in <a href=\"https:\/\/studysection.com\/blog\/how-to-show-list-of-related-records-using-search-filter-in-lwc\/\">LWC<\/a> for an object, but want to get the same lightning page layout as displayed in the standard object creation view.<\/p>\n<h2>HTML:-<\/h2>\n<p><code>&lt;div class=\"slds-modal__container\"><br \/>\n        &lt;header class=\"slds-modal__header\"><br \/>\n                &lt;button class=\"slds-button slds-button_icon slds-modal__close slds-button_icon-inverse\"<br \/>\n                        title=\"Close\" onclick={closeNewObjectModal}><br \/>\n                        &lt;lightning-icon icon-name=\"utility:close\" alternative-text=\"close\"<br \/>\n                                variant=\"inverse\" size=\"small\">&lt;\/lightning-icon><br \/>\n                        &lt;span class=\"slds-assistive-text\">Close&lt;\/span><br \/>\n                &lt;\/button><br \/>\n                &lt;h2 id=\"modal-heading-01\" class=\"slds-text-heading_medium slds-hyphenate\"><br \/>\n                        {modalHeader} : {selectedRecordType}<br \/>\n                &lt;\/h2><br \/>\n        &lt;\/header><br \/>\n        &lt;div class=\"slds-modal__content slds-p-around_medium\" id=\"modal-content-id-2\"><br \/>\n                &lt;lightning-record-edit-form onload={handleRecordEditFormLoad} onsuccess={successNewRecordInsert} object-api-name={objectName}<br \/>\n                        record-type-id={selectedRecordType}><br \/>\n                        &lt;lightning-messages>&lt;\/lightning-messages><br \/>\n                        &lt;template if:true={uiPageLayoutView}><br \/>\n                                &lt;lightning-layout multiple-rows=\"true\"><br \/>\n                                        &lt;lightning-layout-item size=\"12\"><br \/>\n                                        &lt;template for:each={uiPageLayoutView.sections} for:item=\"section\"><br \/>\n                                        &lt;div key={section.id} class=\"slds-grid slds-wrap\"><br \/>\n                                        &lt;div class=\"row slds-grid slds-gutters row-width\"><br \/>\n                                                &lt;h3 class=\"slds-p-vertical_xx-small slds-p-left_medium\" style=\"font-size: 16px\">{section.heading}&lt;\/h3><br \/>\n                                        &lt;\/div><br \/>\n                                        &lt;lightning-layout multiple-rows=\"true\"><br \/>\n                                                &lt;template for:each={section.layoutRows} for:item=\"layoutRow\"><br \/>\n                                                &lt;template for:each={layoutRow.layoutItems} for:item=\"layoutItem\"><br \/>\n                                                        &lt;template for:each={layoutItem.layoutComponents} for:item=\"layoutComponent\"><br \/>\n                                                &lt;lightning-layout-item key={layoutComponent.apiName} size=\"6\" padding=\"horizontal-small\"><br \/>\n                                                       &lt;template if:true={layoutItem.editableForNew}><br \/>\n                                                        &lt;lightning-input-field data-fieldname={layoutComponent.apiName}<br \/>\n                                                                field-name={layoutComponent.apiName} required={layoutItem.required}><br \/>\n                                                        &lt;\/lightning-input-field><br \/>\n                                                        &lt;\/template><br \/>\n                                                        &lt;template if:false={layoutItem.editableForNew}><br \/>\n                                                        &lt;template if:true={layoutComponent.apiName}><br \/>\n                                                                &lt;lightning-output-field field-name={layoutComponent.apiName}><br \/>\n                                                                &lt;\/lightning-output-field><br \/>\n                                                        &lt;\/template><br \/>\n                                                        &lt;\/template><br \/>\n                                                &lt;\/lightning-layout-item><br \/>\n                                                        &lt;\/template><br \/>\n                                                &lt;\/template><br \/>\n                                                &lt;\/template><br \/>\n                                        &lt;\/lightning-layout><br \/>\n                                                &lt;\/div><br \/>\n                                        &lt;\/template><br \/>\n                                        &lt;\/lightning-layout-item><br \/>\n                                &lt;\/lightning-layout><br \/>\n                                        &lt;\/template><br \/>\n                        &lt;lightning-messages>&lt;\/lightning-messages><br \/>\n                &lt;\/lightning-record-edit-form><br \/>\n        &lt;\/div><br \/>\n        &lt;div class=\"footer-background-class\"><br \/>\n                &lt;div class=\"slds-align_absolute-center slds-p-around_xx-small\"><br \/>\n                        &lt;lightning-button class=\"slds-m-around_xx-small\"<br \/>\n                                title=\"Cancel\" label=\"Cancel\"<br \/>\n                                onclick={closeNewObjectModal}><br \/>\n                        &lt;\/lightning-button><br \/>\n                        &lt;lightning-button variant=\"brand\" title=\"Save\"<br \/>\n                                onclick={submitRecordForm} name=\"Save\" label=\"Save\"><br \/>\n                        &lt;\/lightning-button><br \/>\n                &lt;\/div><br \/>\n        &lt;\/div><br \/>\n&lt;\/div><\/code><\/p>\n<h3>JS:-<\/h3>\n<p><code>handleRecordEditFormLoad(event) {<br \/>\n    console.log('Layout => ', JSON.stringify(event.detail.layout));<br \/>\n    this.uiPageLayoutView = event.detail.layout;<br \/>\n}<\/code><\/p>\n<p>This <strong>handleRecordEditFormLoad<\/strong> function that is called on the <strong>onload <\/strong>of <strong>lightning-record-edit-form<\/strong> takes care of the page layout of the object depending on the selected record type as can be seen in the line below, we have passed object-api-name and record-type-id.<\/p>\n<p><code>&lt;lightning-record-edit-form onload={handleRecordEditFormLoad} onsuccess={successNewRecordInsert} object-api-name={objectName} record-type-id={selectedRecordType}><\/code><\/p>\n<p><small>The English language is the most widely used language as a medium of communication around the world. Having a certification for the English language can be an advantage. StudySection provides an <a href=\"https:\/\/www.studysection.com\/english-language-advanced-diploma\">English Certification Exam<\/a> that tests English language proficiency in English grammar, reading, and writing.<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Suppose you want to create a lightning-record-edit-form in LWC for an object, but want to get the same lightning page<\/p>\n","protected":false},"author":1,"featured_media":5878,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[791,41],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Get the page layout of any object in Lightning Web Components-SS Blog<\/title>\n<meta name=\"description\" content=\"Create a lightning form in Lightning Web Components for an object to get the same lightning layout as displayed on the object.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get the page layout of any object in Lightning Web Components-SS Blog\" \/>\n<meta property=\"og:description\" content=\"Create a lightning form in Lightning Web Components for an object to get the same lightning layout as displayed on the object.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Posts on famous people, innovations and educational topics\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/studysection\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-04T04:53:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-04T05:33:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2022\/07\/Lightning-Web.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin-studysection-blog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@studysection\" \/>\n<meta name=\"twitter:site\" content=\"@studysection\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin-studysection-blog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/\"},\"author\":{\"name\":\"admin-studysection-blog\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\"},\"headline\":\"Get the Page Layout of any object in Lightning Web Components\",\"datePublished\":\"2022-07-04T04:53:59+00:00\",\"dateModified\":\"2022-07-04T05:33:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/\"},\"wordCount\":129,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"keywords\":[\"Components\",\"salesforce\"],\"articleSection\":[\"Learn and Grow\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/\",\"url\":\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/\",\"name\":\"Get the page layout of any object in Lightning Web Components-SS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/#website\"},\"datePublished\":\"2022-07-04T04:53:59+00:00\",\"dateModified\":\"2022-07-04T05:33:05+00:00\",\"description\":\"Create a lightning form in Lightning Web Components for an object to get the same lightning layout as displayed on the object.\",\"breadcrumb\":{\"@id\":\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/studysection.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get the Page Layout of any object in Lightning Web Components\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/studysection.com\/blog\/#website\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"name\":\"Blog Posts on famous people, innovations and educational topics\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/studysection.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/studysection.com\/blog\/#organization\",\"name\":\"StudySection\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"contentUrl\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"width\":920,\"height\":440,\"caption\":\"StudySection\"},\"image\":{\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/studysection\",\"https:\/\/twitter.com\/studysection\",\"https:\/\/www.instagram.com\/study.section\/\",\"https:\/\/www.linkedin.com\/company\/studysection\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\",\"name\":\"admin-studysection-blog\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"caption\":\"admin-studysection-blog\"},\"url\":\"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Get the page layout of any object in Lightning Web Components-SS Blog","description":"Create a lightning form in Lightning Web Components for an object to get the same lightning layout as displayed on the object.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/","og_locale":"en_US","og_type":"article","og_title":"Get the page layout of any object in Lightning Web Components-SS Blog","og_description":"Create a lightning form in Lightning Web Components for an object to get the same lightning layout as displayed on the object.","og_url":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/","og_site_name":"Blog Posts on famous people, innovations and educational topics","article_publisher":"https:\/\/www.facebook.com\/studysection","article_published_time":"2022-07-04T04:53:59+00:00","article_modified_time":"2022-07-04T05:33:05+00:00","og_image":[{"width":300,"height":200,"url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2022\/07\/Lightning-Web.png","type":"image\/png"}],"author":"admin-studysection-blog","twitter_card":"summary_large_image","twitter_creator":"@studysection","twitter_site":"@studysection","twitter_misc":{"Written by":"admin-studysection-blog","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/#article","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/"},"author":{"name":"admin-studysection-blog","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402"},"headline":"Get the Page Layout of any object in Lightning Web Components","datePublished":"2022-07-04T04:53:59+00:00","dateModified":"2022-07-04T05:33:05+00:00","mainEntityOfPage":{"@id":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/"},"wordCount":129,"commentCount":0,"publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"keywords":["Components","salesforce"],"articleSection":["Learn and Grow"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/","url":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/","name":"Get the page layout of any object in Lightning Web Components-SS Blog","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/#website"},"datePublished":"2022-07-04T04:53:59+00:00","dateModified":"2022-07-04T05:33:05+00:00","description":"Create a lightning form in Lightning Web Components for an object to get the same lightning layout as displayed on the object.","breadcrumb":{"@id":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/studysection.com\/blog\/get-the-page-layout-of-any-object-in-lightning-web-components\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/studysection.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Get the Page Layout of any object in Lightning Web Components"}]},{"@type":"WebSite","@id":"https:\/\/studysection.com\/blog\/#website","url":"https:\/\/studysection.com\/blog\/","name":"Blog Posts on famous people, innovations and educational topics","description":"","publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/studysection.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/studysection.com\/blog\/#organization","name":"StudySection","url":"https:\/\/studysection.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","contentUrl":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","width":920,"height":440,"caption":"StudySection"},"image":{"@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/studysection","https:\/\/twitter.com\/studysection","https:\/\/www.instagram.com\/study.section\/","https:\/\/www.linkedin.com\/company\/studysection"]},{"@type":"Person","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402","name":"admin-studysection-blog","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","caption":"admin-studysection-blog"},"url":"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/"}]}},"views":4825,"_links":{"self":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/5877"}],"collection":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/comments?post=5877"}],"version-history":[{"count":3,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/5877\/revisions"}],"predecessor-version":[{"id":5881,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/5877\/revisions\/5881"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media\/5878"}],"wp:attachment":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media?parent=5877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/categories?post=5877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/tags?post=5877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}