Delete a Record
| AVAILABLE API VERSION |
|---|
| Beta v59.0–65.0 |
| Generally available v66.0 and later |
Use mutations to delete a record. Within mutations, the RecordDelete field enables you to update all object types your Salesforce user has access to. Only objects supported by UI API are available for mutations.
Example Delete Request
To delete a record, use RecordDelete with the Id for the record you want to delete.
1mutation AccountDeleteExample{
2 uiapi {
3 AccountDelete(input: {
4 Id: "001RM000005eiZZZZZ"
5 })
6 {
7 Id
8 }
9 }
10}Example Response on Deletion
The response body returns the Id value of the record you deleted.
1{
2 "data": {
3 "uiapi": {
4 "AccountDelete": {
5 "Id": "001RM000005eiZZZZZ"
6 }
7 }
8 },
9 "errors": []
10}Record Delete Guidelines
Consider these guidelines for deleting a record.
- Sending a delete request with an incorrect
Idvalue returns aDataFetchingExceptionerror. - Sending a delete request for a record that’s already deleted returns a
DataFetchingExceptionerror.