i am trying to display a related list in an LWC that was deployed in an AppPage
This is the code :
editMaterielAlivrer.js
import { LightningElement, wire } from 'lwc';
import { getRelatedListRecords } from 'lightning/uiRelatedListApi';
export default class EditMaterielAlivrer extends NavigationMixin(LightningElement) {
error;
records;
@wire(getRelatedListRecords, {
parentRecordId: 'a0C7f000005iNUPEA2',
relatedListId: 'Materieaux_a_livrer',
fields : ["Materieaux_a_livrer.Id", "Materieaux_a_livrer.Oeuvre__c"]
})
listInfo({ error, data }) {
if (data) {
console.log('je suis dans data');
console.log(JSON.stringify(data));
this.records = data.records;
this.error = undefined;
} else if (error) {
console.log('je suis dans error');
console.log(JSON.stringify(error));
this.error = error;
this.records = undefined;
}
}
}
the parentRecordId is the contrat__c id , and the relatedListId is the plural label of the object Materiel_a_livrer__c
editMaterielAlivrer.html
<template>
<lightning-card title="Liste des matérieaux à livrer">
<template if:true={records}>
<div class="slds-m-around_medium">
<template for:each={records} for:item="rec">
<p key={rec.fields.Id.value}>
{rec.fields.Name.value}
</p>
</template>
</div>
</template>
</lightning-card>
</template>
editMaterielAlivrer.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>55.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
i have created an AppPage and a button linked to the appPage
The button is added on the 'Matériels à livrer' relatedList on the Contrat__c object
i want to see the related list records that are linked to the contract object on my component
it doesn't work and i have this error in the log
{status:400,body:{message:The related lists UI API currently does not support this related list,statusCode:400,errorCode:INVALID_TYPE},headers:{},ok:false,statusText:Bad Request,errorType:fetchResponse}
any suggestions please !
FYI i am a beginner in LWC
on the relatedListId attrbute i put the plural label, it doesn't work i tried with the apiName of the object it didn't work also