Skip to content

useDML

Import

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

Usage

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

Methods

saveRecord(params) : Promise<Record>

NameTypeDescription
recordRecordRecord to update or insert
objectApiNameObjectApiNameObject API Name

Example

handleInsertNewRecord) {
this.saveRecord(this.Case__ref, 'Case'); // Case__ref doesn't contain an id field
}
handleUpdateRecord) {
this.saveRecord(this.Case); // Case contains an id field
}

deleteRecord(recordId) : Promise<RecordId>

NameTypeDescription
recordIdRecordIdId of the record to delete

Example

deleteRecord() {
this.deleteRecord('XXX');
}

saveRecords(params) : Promise<Record[]>

NameTypeDescription
recordsRecord[]Records to update or insert
objectApiNamesObjectApiName[]Object API Names

Example

insertRecords() {
this.saveRecords([this.Case, this.Contact, this.Account]);
}

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

NameTypeDescription
recordIdsRecordId[]Id of the records to delete

Example

deleteRecords() {
this.deleteRecords(['XXX', 'YYY', 'ZZZ']);
}