2

I have been googling around and haven't found a way to show the history related list of an object inside a component.

Is it possible or would it have to be custom built?

1

I created a custom related list for lightning. Maybe will be helpful https://github.com/artyom-bazyk/singleRelatedList

4

There's no out of the box component available for displaying a related list on a custom lightning component. If you were building a standard record page, you could have done it using Standard Lightning Page Related List Component.

In order to display a related list on a custom lightning component, you may rather like to use lightning:datatable and customize it to your requirements.

1

Well, If we are not able to show Related List in a component, might worth redirecting to them instead?

You can do that using e.force:navigateToRelatedList, just pass the relatedList Api name and get it going.

gotoRelatedList : function (component, event, helper) {
    var relatedListEvent = $A.get("e.force:navigateToRelatedList");
    relatedListEvent.setParams({
        "relatedListId": "Cases",
        "parentRecordId": component.get("v.recordId")
    });
    relatedListEvent.fire();
}

Src: https://developer.salesforce.com/docs/component-library/bundle/force:navigateToRelatedList/documentation

0

Depends where you want to include it/use it, for example, if you are using a lightning:recordEditForm you can simply reference the api name of your field and it will automatically create a lookup field.

Usage Consideration

  • The lookup type is supported in Lightning Experience only. When used in the mobile app, the lookup type is rendered as an input text field.

That being said, if you want to add a lookup field elsewhere and not use the above component, you will most likely have to create a custom lightning component.

There are numerous resources online that provide code snippets on doing so.

The SLDS documentation provides a markup skeleton for you to achieve this.

A quick search will also provide several references to blogs on how to create your own component.

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.