We'd like to use lightning:recordForm to create new objects that are related to a given object so we need to be able to default the id of the related object. I don't see any way of doing this in the documentation. Am I missing something?

  • If you want to create a record, and that you want to "default" values during the process, you should consider using force:createRecord event.
    – Jayant Das
    Jul 25 '18 at 14:11
  • We did consider that. The problem is that when you save the object the UI navigates to the object's record page. We need to stay on our component and be able to update related records after the new object is created. See: lightning-component-createrecord-without-navigating-away-from-current-page
    – Homerlex
    Jul 25 '18 at 14:19
  • Unfortunately, if its not documented, that would mean that there's no such capability of doing it that way.
    – Jayant Das
    Jul 25 '18 at 14:28
  • @Homerlex, in one of your posts, it was mentioend that the lightning:recordEditForm would better fit your use case (based on what you have provided in your posts) any reason why you have not chosen to use it?
    – glls
    Jul 25 '18 at 16:26
  • @glls - recordForm would be lot less work (if we could get it to take defaults)
    – Homerlex
    Jul 26 '18 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.