Front-end events are actions on the product UI, such as button clicks and changes/updates to the UI field values. Events method is an interface that the developer platform provides, to enable your app to react to front-end events.
To enable your app to react to front-end events, in the app.js file,
- Subscribe to the app.initialized event, through an event listener. When the app is initialized, the parent application passes a client reference to the app.
- After app initialization,
- Use the client reference, subscribe to <Event name> and register a callback method to be executed when the event occurs.
- Define the callback method.
When the event occurs, a payload is passed to the callback method. Let us call this payload event. event.type returns the name of the event. The event.helper.getData() helper method returns a JSON object that contains information pertaining to the event. Your app logic can process this data into meaningful results.
Front-end events are of the following types: Click events, Change events, Intercept events.
Currently, for this module, only Change events and one click event (cti.triggerDialer) are supported.
Click events
These events occur when a user clicks a button or link on the page.
Change events
These events occur when a user changes the value of a field on the UI.
Note:User need not submit the modified value for the event listeners to pick up the event and execute the callback; merely changing the values is sufficient for the event trigger.
The event.helper.getData() method returns a JSON that contains the old and new values of the changed field.
Common event
If your app is built to be deployed on the cti_sidebar placeholder, the app can react to the cti.triggerDialer event when the corresponding event trigger occurs.
Event name | Event trigger |
---|---|
cti.triggerDialer | When a user clicks the call icon or phone number link that is displayed on any of the following pages of the product UI:
|
cti.triggerDialer
Use the sample code shown on the right pane > Sample code tab, to enable your app to react to user clicks such as the click on a call icon or phone number, on the UI.
New email page events
Event name | Event trigger |
---|---|
Change events | |
ticket.fromChanged | When a user changes the From address of a ticket. |
ticket.priorityChanged | When a user changes the priority of a ticket. |
ticket.statusChanged | When a user changes the status of a ticket. |
ticket.groupChanged | When a user changes the group to which a ticket is assigned. |
ticket.agentChanged | When a user changes the agent to whom a ticket is assigned. |
ticket.typeChanged | When a user changes the type of a ticket. |
Event descriptions
ticket.fromChanged
Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user changes the From address of a ticket.
ticket.priorityChanged
Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user changes the priority of a ticket.
ticket.statusChanged
Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user changes the status of a ticket.
ticket.groupChanged
Use the sample code shown on the right pane > Sample code tab, to enable your app to react twhen a user changes the group assigned to a ticket.
ticket.agentChanged
Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user changes the agent assigned to a ticket.
ticket.typeChanged
Use the sample code shown on the right pane > Sample code tab, to enable your app to react when a user changes the type of a ticket.