How to build a custom lightning component related list with real-time REST data. For this tutorial, I’ll show a technique on how to integrate external data and display the data real-time as a related list in Salesforce. This would not use an external object but a simple custom related list component that uses lightning:datatable base component and a controller than retrieves data via callout to an external REST resource and display them in Salesforce.
This is how it would look like.
For this, I’m calling this a static REST resource that returns the following JSON response.
Next, we need to display this data in a related list in Salesforce. We create a simple lightning component that we can add using Lightning App builder.
Start with the following lightning component markup.
And controller that calls a helper.
Note: you do not need the var actions as this is for another method I’m working on.
Then for my controller, I have this simple call to my server
Then I simply drop the component on Lightning App Builder to the related list section for a quick UI match. That should be it.