-
Notifications
You must be signed in to change notification settings - Fork 26
MobileCRM.UI.EntityForm.DetailCollection.addAsync
rescocrm edited this page May 15, 2023
·
1 revision
[v10.0] Appends the product into sales order collection.
Resulting MobileCRM.DynamicEntity object implements method "update" which can be used to update the entity properties in the sales detail collection.
Argument | Type | Description |
---|---|---|
product | MobileCRM.Reference | A reference of the product to be appended. |
quantity | Number | Product quantity. |
This example demonstrates how to add a new product with given quantity into order details.
// WARNING: async/await pattern requires ECMAScript 6 and it's not supported on Internet Explorer.
// It's supported by all modern browsers including mobile version of Chrome and Safari (requires Android 5+ and iOS 10+).
function addNewProduct(productId, quantity) {
return __awaiter(this, void 0, void 0, function* () {
try {
var productRef = new MobileCRM.Reference("product", productId);
var orderDetail = yield MobileCRM.UI.EntityForm.DetailCollection.addAsync(productRef, quantity);
MobileCRM.bridge.alert("Product added");
}
catch (err) {
MobileCRM.bridge.alert(err);
}
});
}