23 thoughts on “Rendering Lightning:RecordEditForm based on the page layout

    1. Naval Sharma Post author

      You need to check section.totalColumns value as we are using this to set the multipleColumn property.

      Reply
  1. Naval Sharma Post author

    You will have to use smallDeviceSize, mediumDeviceSize, largeDeviceSize attributes on lightning:layoutItem.

    Reply
  2. Bharti Harimohan

    Hi,

    Can you please also assist me to display page layout required fields using recordeditForm with lightning:inputField ?

    Reply
  3. shravya

    Hi , I tried doing the same . it was very helpful . but for some reason the required custom fields are not required .How to handle this

    Reply
  4. AshTric

    Is it possible for multiple record types ?
    If yes what are the required changes we need to make ?

    Reply
  5. Simangaliso Mathenjwa

    nice work!, tell me if the field is marked as required on a page layout, will it be a required field on the component also?

    Reply
  6. Adeel Ahmad

    Great work Naval
    But i am having an issue here, Every time when i pass the page layout name it returns me null so i am unable to proceed further. Do you have any idea why it is not working or salesforce just updated the API

    Thanks!

    Reply
    1. Naval Sharma Post author

      Make sure that you are passing a correct name. If Opportunity has a page layout name “Opportunity Sales Layout” then you need to pass it like. “Opportunity-Opportunity Sales Layout”.

      Reply
  7. Jerun Jose

    Thanks Naval for sharing this awesome post. Works as specified. I’m working on some minor improvements and will share the finished code when complete. You saved a few days of head scratching to get this started.

    Reply
  8. Manju

    HI Naval,

    I could use this in opportunity cloning(with products) where I have to get all the fields in the layout and the corresponding values to pre-populate in the fields. What would be the approach to pre-populate values in the corresponding fields? Appreciate a quick response, I have a three days deadline 🙁

    Thanks
    Manju

    Reply
  9. Gopal Agarwal

    Hi Naval,
    Great Blog.
    What if i need to accumulate multiple layouts at once.

    Can we do so like below?

    List componentNameList = new List{‘Contact-Contact Layout’,’Contact-Contact Sales Layout’ };

    Thanks in advance

    Reply
  10. Madhu

    Hi Naval,
    Nice work! nice work!, I used your approach and created the lightning component but the required fields that are on page layouts are not appearing on the lightning component as required.

    Any one here have same issue?

    Reply
  11. Mayank

    Hello Naval,

    Great Work!!
    how can we get a pagelayout name dynamically instead hard coding.
    As far as i know we can not query a pagelayout using SOQL, so how we can pass pagelayout dynamically based on profile or may be user?

    Reply
    1. Naval Sharma Post author

      Hi Mayank,

      Either user Metadata API or Custom Label/Custom Metadata Types for the mapping.

      Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.