0

I would like to be able to create a record using the standard page layout, but I would like to also allow the addition of a custom component to that page layout.

Currently , it seems that the only way to get custom components is to create a completely new component and code in the individual fields into that component. I don't like this solution because it makes it difficult to maintain.

However, if I wanted to require information from my custom component, I have no way of doing that with a standard creation/edit page layout.

Is it possible to add a custom component to a page layout, or even add a page layout to a custom component so I don't have to hard code the fields?

1 Answer 1

1

You can use force:recordView to place an entire record view (dictated by page layout) in to a custom component. Requires SLDS to view properly, and links/hovers only work in LEX. You can also use force:recordEdit if you want to be able to create/edit a record, instead.

6
  • Does force:recordEdit work without an id, though? Wouldn't {!v.myObject.recordId} return null and then error out?
    – Chance
    Feb 27, 2018 at 16:46
  • Yes, looks like it expects either record or recordId. So this wouldn't work for new records, but should meet your requirements for viewing existing records no?
    – tsalb
    Feb 27, 2018 at 17:25
  • @Chance Yeah, I just realized that, too. But technically, creating a new record does not use the record page, but instead uses a modal dialog, which you'd fire off with force:createRecord instead.
    – sfdcfox
    Feb 27, 2018 at 17:29
  • @sfdcfox so if that uses a modal box, is there any way to insert my own custom component into that modal so that I can require information from that before the record can be saved? It seems as though I am still in the same position. Is there a way to redirect after the record save to my component.
    – Chance
    Feb 27, 2018 at 19:25
  • @Chance Nope. Say, any reason why you're not just making a Lightning Record Page? That way, you can show your custom component as well as the record details...
    – sfdcfox
    Feb 27, 2018 at 19:30

You must log in to answer this question.

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