Events Methods

You can use the events methods to enable apps to react to events that occur in the user interface of a page. The events can be updates to field values. An app can register event listeners that are invoked when an event occurs.

Event Payload
When the callback method is invoked, an event payload is passed to it. The payload is a JavaScript object which contains a type field and data object.

1
2
3
4
5
// event_type contains the name of the event var event_type = event.type; // event_data is a JSON whose value depends on the type of event var event_data = event.helper.getData();

The helper event.helper.getData() method for all events returns {"id": "1"}. Here, 1 is the ID of the current entity/module in which the app is present.

Contact Details Page Events

contact.update - This event is available to all apps located on the Contact Details page and is triggered when a user updates a contact.

Copied Copy
1
2
3
4
5
var propertyChangeCallback = function (data) { console.log(data.type + " event occurred"); }; client.events.on("contact.update", propertyChangeCallback);
Deal Details Page Events

deal.update - This event is available to all apps located on the Deal Details page and is triggered when a user updates a deal.

Copied Copy
1
2
3
4
5
var propertyChangeCallback = function (data) { console.log(data.type + " event occurred"); }; client.events.on("deal.update", propertyChangeCallback);
Sales Account Details Page Events

account.update - This event is available to all apps located on the Account Details page and is triggered when a user updates an account.

Copied Copy
1
2
3
4
5
var propertyChangeCallback = function (data) { console.log(data.type + " event occurred"); }; client.events.on("account.update", propertyChangeCallback);