deleteRecord (Client API reference)
Deletes a table record.
Syntax
Xrm.WebApi.deleteRecord(entityLogicalName, id).then(successCallback, errorCallback);
Parameters
Name | Type | Required | Description |
---|---|---|---|
entityLogicalName |
String | Yes | The table logical name of the record you want to delete. For example: account . |
id |
String | Yes | GUID of the table record you want to delete. |
successCallback |
Function | No | A function to call when a record is deleted. See Return Value |
errorCallback |
Function | No | A function to call when the operation fails. |
Return Value
On success, returns a promise object to the successCallback
with the following properties:
Name | Type | Description |
---|---|---|
entityType |
String | The table logical name of the record. |
id |
String | GUID of the record. |
name |
String | Name of the record. |
Examples
These examples use some of the same request objects as demonstrated in Update and delete tables using the Web API to define the data object for updating an entity record.
Deletes an account with record ID = 5531d753-95af-e711-a94e-000d3a11e605.
Xrm.WebApi.deleteRecord("account", "5531d753-95af-e711-a94e-000d3a11e605").then(
function success(result) {
console.log("Account deleted");
// perform operations on record deletion
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
Related articles
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho