[SalesForce] use getListUi method with Related List Views

Apologies if this question doesn't make sense. I'm fairly new to Salesforce and LWC.

I am creating a component for the Service Console on the Account page. Essentially I want it to return a list of Contact records that are related to the Account that is currently being viewed. I know there are standard components that do this, but I need to add some custom functionality.

I have created a List View with no filters that just returns all Contacts, but obviously I want to do the filtering to get the related Contacts on the server side, not the client side.

If it's not possible to do this with getListUi then I guess I'll have to use APEX + SOQL.

    @track contacts;

    @wire(getListUi, { objectApiName: CONTACT_OBJECT, listViewApiName: 'Test_View' })
    wiredContent({data}) {
        if (data) {
            this.contacts = data.records.records;
        }
    }

Best Answer

Currently, no. That @wire adapter does not allow relative parent (flexipage record Id).

On the roadmap (no ETA) is the lightning:relatedList base component, so whenever that is released we might be also supplied the corresponding @wire adapter for custom use.

See it near the bottom here:

https://help.salesforce.com/apex/HTViewHelpDoc?id=lightning_components_roadmap.htm