Deal update event -Events API

Am trying to capture deal update event using Events API. I tried sample method in documentation
`
var propertyChangeCallback = function (data)
{
console.log(data.type + " event occurred");
};
client.events.on(“deal.update”, propertyChangeCallback);

`

Documentation says “Event APIs enable you to react to events that occur in the user interface of a page. This includes updates to field values. You can register event listeners which are invoked when an event occurs.”

How will i get updated field value as the part of deal update event ?. I tried logging console.log(data.data) i don’t find any data over there, Please help me out. @Hem @Saif

Hi @Sudharsan_Danasu,

An event is passed to the callback as mentioned in document.

you can get the data associated with the event by event.helper.getData()

In the above example
var propertyChangeCallback = function (data)
{
console.log(data.type + " event occurred");
console.log(data.helper.getData(), “data associated”);
};
client.events.on(“deal.update”, propertyChangeCallback);

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.

Hence for deal update, it will return deal id.

Please let us know if you are still facing issues with events API.

2 Likes