You said the LWC would load records so that's what you have to do.
Details can be found here
https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.reference_wire_adapters_record
but basically you just have to use the getRecord
wire method
import { getRecord} from 'lightning/uiRecordApi';
The full example by the documentation:
import { LightningElement, wire } from 'lwc';
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import NAME_FIELD from '@salesforce/schema/Account.Name';
import OWNER_NAME_FIELD from '@salesforce/schema/Account.Owner.Name';
import PHONE_FIELD from '@salesforce/schema/Account.Phone';
import INDUSTRY_FIELD from '@salesforce/schema/Account.Industry';
export default class Example extends LightningElement {
@wire(getRecord, { recordId: '001456789012345678', fields: [NAME_FIELD, INDUSTRY_FIELD], optionalFields: [PHONE_FIELD, OWNER_NAME_FIELD] })
account;
get name() {
return getFieldValue(this.account.data, NAME_FIELD);
}
get phone() {
return getFieldValue(this.account.data, PHONE_FIELD);
}
get industry(){
return getFieldValue(this.account.data, INDUSTRY_FIELD);
}
get owner() {
return getFieldValue(this.account.data, OWNER_NAME_FIELD);
}
}
To update it you'll need to call the updateRecord
method with the properly formatted parameters
updateRecord(recordInput: Record, clientOptions?: Object): Promise<Record>
where recordInput
is
{
"apiName": "Account",
"fields": {
"Name": "Universal Containers"
}
}
myAccount = ACCOUNT_OBJECT;