To navigate to a related list, set the parent record ID on the parentRecordId attribute and fire the event. For example, to display a related list for a Contact object, the parentRecordId is Contact.Id. This example displays the related cases for a contact record.
gotoRelatedList : function (component, event, helper) { var relatedListEvent = $A.get("e.force:navigateToRelatedList"); relatedListEvent.setParams({ "relatedListId": "Cases", "parentRecordId": component.get("v.contact.Id") }); relatedListEvent.fire(); }
Attribute Name | Type | Description | Required? |
---|---|---|---|
parentRecordId | String | The ID of the parent record. | Yes |
relatedListId | String | The API name of the related list to display, such as “Contacts” or “Opportunities”. | Yes |