Skip to main content

Posts

Showing posts from April, 2024

How to get related records without using Apex?

getRelatedListRecords You can utilize this wire adapter to access RelatedList records. Related lists present information and links to records linked with a particular record. For instance, an account might have related lists for contacts, cases, notes, or files. Demo Code: import  {  LightningElement , wire, api }  from   'lwc' ; import  { getRelatedListRecords }  from   'lightning/uiRelatedListApi' ; export   default   class   Acc   extends   LightningElement  {     error;   records;       @ wire(getRelatedListRecords, {     parentRecordId:  '0015g00000DMcjgAAD' ,     relatedListId:  'Contacts' ,     fields: [ 'Contact.Name' , 'Contact.Id' ],     sortBy: [ 'Contact.Name' ]   })   listInfo({ error, data })...