Skip to content

MobileCRM.UI.EntityForm.DetailCollection.onChange

rescocrm edited this page May 15, 2023 · 1 revision

[v8.2] Binds or unbinds the handler which is called when the list of sales details changes.

Arguments

Argument Type Description
handler function(entityForm) The handler function that has to be bound or unbound.
bind Boolean Determines whether to bind or unbind the handler.
scope Object The scope for handler calls.

This example demonstrates how to use DetailCollection onChange handler and display the detail form of currently changed product.

MobileCRM.UI.EntityForm.DetailCollection.onChange(function (entityForm) {
	/// <param name="entityForm" type="MobileCRM.UI.EntityForm"/>
	/// retrieve last added product new index from context
	var changedProductIndex = entityForm.context.newIndex;
	if (changedProductIndex >= 0) {
		MobileCRM.UI.EntityForm.DetailCollection.get(changedProductIndex, function (detail) {
			/// open actually changed product.
			MobileCRM.UI.EntityForm.openSalesEntityDetail(detail, MobileCRM.bridge.alert, null);
		}, MobileCRM.bridge.alert);
	}
}, true);
Clone this wiki locally