useSObject
Import
import { mix, useSObject, BoltElement } from 'c/bolt';
Usage
export default class myLwc extends mix( [useSObject, fields, recordTypeId], BoltElement) { }
Methods
Constructor(params) : Constructor
Name | Type | Description |
---|---|---|
fields | Field[] | List of imported fields |
recordTypeId ? | RecordId | Defaulted to default |
Example
import FirstName from '@salesforce/schema/Contact.FirstName';export default class myLwc extends mix( [useSObject, [FirstName]], BoltElement) {}
Dynamic Attributes
<relatedListApiName>__ref : RecordRef
The __ref
identifier gives a boilerplate object whose keys represent the imported fields and where values are initialized as undefined.
Contact__ref: { FirstName: undefined}
Example
import FirstName from '@salesforce/schema/Contact.FirstName';export default class myLwc extends mix( [useSObject, [FirstName]], BoltElement) {}
<template> <lightning-input value={Contact__ref.FirstName}> </lightning-input></template>
<relatedListApiName>__info : RecordInfo
The __info
identifier gives a description of the object including :
- label
- dataType
- picklistValues (if is of type picklist)
Contact__info: { FirstName: { label: "Contact's First Name", dataType: "string", }}
Example
import FirstName from '@salesforce/schema/Contact.FirstName';export default class myLwc extends mix( [useSObject, [FirstName]], BoltElement) {}
<template> <lightning-input label={Contact__info.FirstName.label}> </lightning-input></template>