This course is currently a work in progress. Please join the waitlist to receive regular updates.
Delete statement in apex
The DML delete statement is used to delete existing records from the salesforce database. To delete records, you need the Id's of the existing records.
Once you have the record instances with id of the record, use the DELETE operation to delete the records from the salesforce database.
Here is an example of a DML delete statement to delete an existing account record in salesforce.
Delete Operation
Delete a record from the database.
Loading...
In the above example:
Note
Once records are deleted from the database, Salesforce will, by default keep the deleted records in the Recycle Bin for 15 days before permanently deleting them from the database.
Try It Yourself
Loading...