Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created June 5, 2022 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arun12209/2ee56d5f588e4a5462ec18c168eb304a to your computer and use it in GitHub Desktop.
Save arun12209/2ee56d5f588e4a5462ec18c168eb304a to your computer and use it in GitHub Desktop.
import { LightningElement,api,wire } from 'lwc';
import { getRelatedListRecordsBatch } from 'lightning/uiRelatedListApi';
export default class GetRelatedListRecordBatch extends LightningElement {
//get Account Related List Records
@api recordId;
error;
records;
@wire(getRelatedListRecordsBatch, {
parentRecordId: '$recordId',
relatedListParameters: [
{
relatedListId: 'Contacts',
fields: ['Contact.Name','Contact.Id']
},
{
relatedListId: 'Opportunities',
fields: ['Opportunity.Name','Opportunity.Amount']
},
{
relatedListId: 'Cases',
fields: ['Case.Subject','Case.Id']
}
]
}) allListInfo({ error, data }) {
if (data) {
this.records = data.records;
console.log('data: '+JSON.stringify(data));
this.error = undefined;
} else if (error) {
this.error = error;
this.records = undefined;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment