Skip to content

useDML

Import

import { mix, useDML, BoltElement } from 'c/boltage';

Usage

export default class myLwc extends mix(
BoltElement,
useDML
) { }
NameTypeDescription
recordRecordRecord to update or insert
objectApiNameObjectApiNameObject API Name
async handleInsertNewRecord) {
await this.saveRecord(this.Case__ref, 'Case'); // Case__ref doesn't contain an id field
}
async handleUpdateRecord) {
await this.saveRecord(this.Case); // Case contains an id field
}

deleteRecord(recordId) : Promise<RecordId>

Section titled “deleteRecord(recordId) : Promise<RecordId>”
NameTypeDescription
recordIdRecordIdId of the record to delete
async deleteRecord() {
await this.deleteRecord('XXX');
}
NameTypeDescription
recordsRecord[]Records to update or insert
objectApiNamesObjectApiName[]Object API Names
insertRecords() {
this.saveRecords([this.Case, this.Contact, this.Account]);
}

deleteRecords(recordId[]) : Promise<RecordId[]>

Section titled “deleteRecords(recordId[]) : Promise<RecordId[]>”
NameTypeDescription
recordIdsRecordId[]Id of the records to delete
async deleteRecords() {
await this.deleteRecords(['XXX', 'YYY', 'ZZZ']);
}