Deleting Records With SMQL
To delete records, you must first retrieve them from the database.
def records = Database.query("SELECT io_uuid, io_name FROM
io_basic_object_for_test where io_uuid = :io_uuid",
[io_uuid:recordUUID]);
def record = records.get(0);
record.delete()
// Or
Database.delete(record)
// Or
Database.delete(records)
To retrieve deleted records from the database, specify the value of the io_deleted field.
def records = Database.query("SELECT io_uuid, io_name FROM io_basic_object_for_test where io_uuid = :io_uuid AND io_deleted = true", [io_uuid:recordUUID]);
For more information: