Skip to content

MobileCRM.Bridge.onGlobalEvent

rescocrm edited this page May 15, 2023 · 11 revisions

[v9.0] Binds or unbinds the handler for global event.

This methods binds or unbinds a handler which is called when this or other iFrame raises the specified event by calling the MobileCRM.bridge.raiseGlobalEvent method.

It can also bind a handler for pre-defined events EntityFormClosed, IFrameFormClosed, SyncStarted and SyncFinished.

Arguments

Argument Type Description
eventName String Global event name.
handler function(args) 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 register custom global event. Other iFrame can raise the event and provide the parameters. See raiseGlobalEvent for example of raising such an event.

MobileCRM.bridge.onGlobalEvent("MyCustomEvent", function (args) {
	MobileCRM.bridge.alert("Retreived arguments from raised event 'MyCustomEvent' " + JSON.stringify(args));
}, true);

This example demonstrates how to use global event listener to handle the EntityFormClosed event for refreshing the product list on Order form after editing one of its product details.

MobileCRM.bridge.onGlobalEvent("EntityFormClosed", function (closedEntityForm) {
	/// <param name='closedEntityForm' type='MobileCRM.UI.EntityForm'>An EntityForm object representing the form that was closed.</param>
	if (closedEntityForm.entity.entityName == "salesorderdetail")
		onProductChanged(closedEntityForm.entity.id);
}, true);

Clone this wiki locally