Skip to content

useRelatedRecords

Import

import { mix, useRelatedRecords, BoltElement } from 'c/bolt';

Usage

export default class myLwc extends mix(
[useRelatedRecords, fields],
BoltElement
) { }

Methods

Constructor(params) : Constructor

NameTypeDescription
relatedListIdstringList of import fields
fieldsField[] OR string[]List of imported fields or list of field path as strings
where?stringFiltering condition
sortBy?stringSorting logic
pageSize?numberPagination 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)
);
}
}