Skip to content

MobileCRM.UI.EntityList.onChange

rescocrm edited this page May 15, 2023 · 8 revisions

[v10.0] Binds or unbinds the handler for onChange event on EntityList.

Bound handler is called with the EntityList object as an argument. The EntityList context object contains "entities" property with the list of currently changed entities (typically just one entity) and property "propertyName" with the field name that was changed.

Arguments

Argument Type Description
handler function(entityList) 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 set an "onChange" handler to perform the address field validation for editable rows on the entity list.

MobileCRM.UI.EntityList.onChange(function (entityList) {
	/// <param name='entityList' type='MobileCRM.UI.EntityList'/>
	var context = entityList.context;
	if (context.propertyName == "address1_line1") {
		var editedEntities = entityList.context.entities;
		var props = editedEntities[0].properties;
		if (!props.address1_city)
			props.address1_city = "Boston";
	}
}, MobileCRM.bridge.alert, null);
Clone this wiki locally