On this Section we will see the How to Delete the records on Dynamics 365 instance.
1. To delete records Xrm.WebApi.deleteRecord. the required parameter is given below:
- Entity Logical Name
- Entity Guid
Syntax : Xrm.WebApi.deleteRecord("Entiy", "Guid")
Example : Retrive Record
//Note :- Initialized the XRM boject first
var Xrm = parent.Xrm;
//Step 1- Create a Javascript fumction
function deleteRecord() {
try {
Xrm.WebApi.deleteRecord("contact","xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx")
.then(function (result) {
Xrm.Utility.alertDialog("Record deleted successfully.");
})
.fail(function (error) {
Xrm.Utility.alertDialog(e.message);
});
} catch (e) {
Xrm.Utility.alertDialog(e.message);
}
}
Comments
Post a Comment