I'd like to build a custom component similar to the post below: Lightning - Related List The answer for that post above works only for the visualisation. However, it does not describe the Write access feature of the object.

The lightning component should display 1 selected related object and should have a function to New, Edit, and Save.

Using only that specific object in the page layout would not work, as we also need to display other related list objects in the related list component.

With the Edit:

  • I tried with force:editRecord, however upon saving, it does not refresh the page. The event handler does not seem to listen to the event.
  • Using force:recordEdit, the page lose the visualisation of the parent object and unable to navigate back to the same page.

with the New:

  • with the force:createRecord, it does not let me to default certain fields (eg: parentId).

Any help would be appreciated.



I created a custom related list for lightning. It provides New, Edit, Delete functions and you can add new one as well. The component you can find https://github.com/artyom-bazyk/singleRelatedList

<c:singleRelatedList recordId="{!v.contact.AccountId}" 
                     fields="Name, StageName, CloseDate, Amount"
  • recordId - Id of parent record (Required)
  • sobjectApiName - Name of parent sobject (Required)
  • relatedFieldApiName - Name of lookup or master-detail field on child sobject (Required)
  • sortedBy - Name of field used for sorting (Required)
  • sortedDirection - ASC or DESC for ascending/descending directions of sorting (Optional)
  • fields - List of API Names for displaying (Required)
  • columns - Array of the columns object that's used to define the data types (Required). For data types read datatable specification

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.