useDML
Import
import { mix, useDML, BoltElement } from 'c/bolt';
Usage
export default class myLwc extends mix( [useDML], BoltElement) { }
Methods
saveRecord(params) : Promise<Record>
Name | Type | Description |
---|---|---|
record | Record | Record to update or insert |
objectApiName | ObjectApiName | Object 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>
Name | Type | Description |
---|---|---|
recordId | RecordId | Id of the record to delete |
Example
deleteRecord() { this.deleteRecord('XXX'); }
saveRecords(params) : Promise<Record[]>
Name | Type | Description |
---|---|---|
records | Record[] | Records to update or insert |
objectApiNames | ObjectApiName[] | Object API Names |
Example
insertRecords() { this.saveRecords([this.Case, this.Contact, this.Account]); }
deleteRecords(recordId[]) : Promise<RecordId[]>
Name | Type | Description |
---|---|---|
recordIds | RecordId[] | Id of the records to delete |
Example
deleteRecords() { this.deleteRecords(['XXX', 'YYY', 'ZZZ']); }