Skip to main content

deleteRecord

This function deletes the current record or a specified record from the database. It provides options to bypass the confirmation dialog and triggers appropriate events before and after deletion.

Syntax

app.deleteRecord(options)

Parameters

ParameterTypeDescription
optionsObject/NumberEither a record ID (Number) or an options object with the following properties
options.idNumber(Optional) The ID of the record to delete. If not provided, the current record ID (app.recordId) will be used
options.noConfirmMessageBoolean(Optional) If true, the confirmation dialog will be skipped. Default is false

Return Value

This function doesn't return a value. However, it:

  1. Triggers the RecordDeleted event if successful
  2. Creates a new empty record if successful
  3. Logs the operation in the system log

Examples

Example 1: Delete the current record with confirmation dialog:

// Delete the current record with confirmation dialog
app.deleteRecord();

Example 2: Delete a specific record with confirmation dialog:

// Delete record with ID 123 with confirmation dialog
app.deleteRecord(123);
// Alternative with options object
app.deleteRecord({id: 123});

Example 3: Delete the current record without confirmation:

// Delete the current record without showing confirmation
app.deleteRecord({noConfirmMessage: true});

Example 4: Delete a specific record without confirmation:

// Delete record with ID 123 without showing confirmation
app.deleteRecord({id: 123, noConfirmMessage: true});

Events

EventTimingPurpose
RecordDeleteBefore deletionAllows cancellation of the delete operation
RecordDeletedAfter successful deletionNotifies that a record was successfully deleted

Notes

  • If the RecordDelete event returns false, the deletion will be canceled.
  • After successful deletion, a new empty record will be created via newRecord().
  • This function adds an entry to the application log with the status of the operation.