How to Mark Records Deleted Without Physically Deleting Them


In some applications, you may want to allow users to mark records as 'deleted' without physically deleting the record from the database. this can be done using a logical field to flag a record as deleted.


Records can be "logically" deleted in a table by using a logical or bit field to track whether or not a record has been deleted. Using JavaScript, you can mark a record as 'deleted' by setting the value of the isDeleted field in the record to true. For example, the code below sets the deleted state for a row to true. The delete state is tracked by the field called "isDeleted":


You can take this a step further and include the ability to "undelete" a record. This is done by first checking if the record has been deleted and then setting the value of the isDeleted field to the appropriate value:

function toggleDelete(rowNum) {
    var isDel = {grid.object}.getValue('G','ISDELETED',rowNum);
    if (isDel) {
    } else {

The JavaScript method defined above can be called from the click event for a button in the same row as the record delete or undelete a record:


For additional information and an explanation of how to add the "isDeleted" field to your database records, watch the video below:

Marking Records as 'Deleted' without Physically Deleting Them