useRelatedRecords
Import
import { mix, useRelatedRecords, BoltElement } from 'c/bolt';
Usage
export default class myLwc extends mix( [useRelatedRecords, fields], BoltElement) { }
Methods
Constructor(params) : Constructor
Name | Type | Description |
---|---|---|
relatedListId | string | List of import fields |
fields | Field[] OR string[] | List of imported fields or list of field path as strings |
where ? | string | Filtering condition |
sortBy ? | string | Sorting logic |
pageSize ? | number | Pagination option |
Example
import FirstName from '@salesforce/schema/Contact.FirstName';export default class myLwc extends mix( [useRelatedRecords, { relatedListId: 'Cases', fields: [FirstName] }], BoltElement) { parentRecordId = 'XXXX'; }
Dynamic Attributes
<relatedListApiName> : Record[]
Example
import FirstName from '@salesforce/schema/Contact.FirstName';export default class myLwc extends mix( [useRelatedRecords, { relatedListId: 'Contacts', fields: [FirstName] }], BoltElement) { parentRecordId = 'XXXX'; doSomething() { this.Contacts.forEach(contact => console.log(contact.FirstName) ); } }