MobileCRM.UI.EntityForm.DetailCollection.add - Resconet/JSBridge GitHub Wiki
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. |
callback | function(MobileCRM.DynamicEntity) | The callback function which is called asynchronously with MobileCRM.DynamicEntity object as an argument. |
errorCallback | function(errorMsg) | The errorCallback which is called in case of error. |
scope | Object | The scope for callbacks. |
This example demonstrates how to add a new product into order details.
function addNewProduct(productId, quantity) {
var productRef = new MobileCRM.Reference("product", productId);
MobileCRM.UI.EntityForm.DetailCollection.add(productRef, function (orderDetail) {
/// <param name="orderDetail" type="MobileCRM.DynamicEntity"/>
orderDetail.properties["quantity"] = quantity;
orderDetail.update(function (err) {
if (err)
MobileCRM.bridge.alert(err);
else
MobileCRM.bridge.alert("Product added");
});
}, MobileCRM.bridge.alert);
}