MobileCRM.UI.EntityList.onCommand - Resconet/JSBridge GitHub Wiki

Binds or unbinds the handler for EntityList command.

Bound handler is called with the EntityList object as an argument. The EntityList context object contains the "cmdParam" property and "entities" property with the list of currently selected entities.

Arguments

Argument Type Description
command String The name of the EntityList command.
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 display the parent account form by pressing the custom contact list button 'OpenAccount'. The custom command can be added on the view via Woodford/Resco CRM.

MobileCRM.UI.EntityList.onCommand("custom_OpenAccount", function (entityList) {
	/// <param name='entityList' type='MobileCRM.UI.EntityList'>
	var selectedEntities = entityList.context.entities;
	if (selectedEntities.length === 1) {
		var customer = selectedEntities[0];
		MobileCRM.UI.FormManager.showDetailDialog(customer.entityName, customer.id);
	}
}, true, null);