Skip to content

MobileCRM.UI.EntityForm.DetailCollection.getAsync

rescocrm edited this page Aug 2, 2024 · 2 revisions

Asynchronously returns requested sales entity detail (e.g. Order detail)

Arguments

Argument Type Description
index Number An index of requested item.

This example demonstrates how to update the order detail quantity.

// 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 increaseQuantity(orderDetailIndex, increment) {
	return __awaiter(this, void 0, void 0, function* () {
		try {
			var detail = yield MobileCRM.UI.EntityForm.DetailCollection.getAsync(orderDetailIndex);
			detail.properties["quantity"] = +detail.properties["quantity"] + increment; // work with numbers, not strings!
			// Update the SalesOrderDetail entity in order details collection
			detail.update();
		}
		catch (err) {
			MobileCRM.bridge.alert(err);
		}
	});
}
Clone this wiki locally