-
Notifications
You must be signed in to change notification settings - Fork 24
MobileCRM.UI.EntityForm.DetailCollection.deleteById
rescocrm edited this page May 15, 2023
·
1 revision
Deletes the sales entity detail (e.g. Order detail) by id.
| Argument | Type | Description |
|---|---|---|
| id | String | An id of the item to be deleted. |
| callback | Function | The callback function which is called asynchronously in case of success. |
| errorCallback | function(errorMsg) | The errorCallback which is called in case of error. |
| scope | Object | The scope for callbacks. |
This example demonstrates how to delete first existing product on order detail.
function deleteProduct() {
// retrieve first product if exist from order detail
MobileCRM.UI.EntityForm.DetailCollection.getAll(function (details) {
/// <param name="details" type="Array<MobileCRM.DynamicEntity>"/>
if (details.length) {
var product = details[0];
MobileCRM.UI.EntityForm.DetailCollection.deleteById(product.id, function () {
MobileCRM.bridge.alert("Product " + product.properties.productdescription + " successfully deleted.");
}, MobileCRM.bridge.alert);
}
else
MobileCRM.bridge.alert("Order doesn't contain any product.");
}, MobileCRM.bridge.alert);
}