useRelatedRecords
Import
import { mix, useRelatedRecords, BoltElement } from 'c/boltage';Usage
export default class myLwc extends mix( BoltElement, useRelatedRecords({ relatedListId, fields, where, sortBy, pageSize, optionalFields })) { }Methods
Section titled “Methods”Constructor(params) : Constructor
Section titled “Constructor(params) : Constructor”| Name | Type | Description |
|---|---|---|
relatedListId | string | List of import fields |
fields | Field[] | 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
Section titled “Example”import FirstName from '@salesforce/schema/Contact.FirstName';export default class myLwc extends mix( BoltElement useRelatedRecords({ relatedListId: 'Cases', fields: [FirstName] })) { parentRecordId = 'XXXX'; }Dynamic Attributes
Section titled “Dynamic Attributes”<relatedListApiName> : Record[]
Section titled “ : Record[]”Example
Section titled “Example”import FirstName from '@salesforce/schema/Contact.FirstName';export default class myLwc extends mix( BoltElement useRelatedRecords({ relatedListId: 'Cases', fields: [FirstName] })) { parentRecordId = 'XXXX'; doSomething() { this.Contacts.forEach(contact => console.log(contact.FirstName) ); } }